@unified-latex/unified-latex-util-to-string
TypeScript icon, indicating that this package has built-in type declarations

1.7.1 • Public • Published

unified-latex-util-to-string

What is this?

Functions parse strings to a unified-latex Abstract Syntax Tree (AST).

When should I use this?

If you have a string that you would like to parse to a unified-latex Ast.Ast, or if you are building a plugin for unified() that manipulates LaTeX.

Install

npm install @unified-latex/unified-latex-util-to-string

This package contains both esm and commonjs exports. To explicitly access the esm export, import the .js file. To explicitly access the commonjs export, import the .cjs file.

Plugins

unifiedLatexStringCompiler

Unified complier plugin that prints a LaTeX AST as a string.

Usage

unified().use(unifiedLatexStringCompiler[, options])

options

{ pretty?: boolean; printWidth?: number; useTabs?: boolean; forceNewlineEnding?: boolean; }

Type

Plugin<{ pretty?: boolean; printWidth?: number; useTabs?: boolean; forceNewlineEnding?: boolean; }[], Ast.Root, string>

function unifiedLatexStringCompiler(options: {
  pretty?: boolean;
  printWidth?: number;
  useTabs?: boolean;
  forceNewlineEnding?: boolean;
}): void;

Functions

toString(ast)

Convert an AST into a string, pretty-printing the result. If you want more control over the formatting (e.g. spaces/tabs, etc.) use unified().use(unifiedLatexStringCompiler, options) directly.

function toString(ast: Ast.Ast): string;

Parameters

Param Type
ast Ast.Ast

Types

PluginOptions

export type PluginOptions =
    | {
          pretty?: boolean;
          printWidth?: number;
          useTabs?: boolean;
          /**
           * If true, formatted code always ends with a newline character.
           */
          forceNewlineEnding?: boolean;
      }
    | undefined;

Package Sidebar

Install

npm i @unified-latex/unified-latex-util-to-string

Weekly Downloads

467

Version

1.7.1

License

MIT

Unpacked Size

133 kB

Total Files

7

Last publish

Collaborators

  • siefkenj