Functions parse strings to a unified-latex
Abstract Syntax Tree (AST).
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.
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.
unifiedLatexStringCompiler
Unified complier plugin that prints a LaTeX AST as a string.
unified().use(unifiedLatexStringCompiler[, options])
{ pretty?: boolean; printWidth?: number; useTabs?: boolean; forceNewlineEnding?: boolean; }
Plugin<{ pretty?: boolean; printWidth?: number; useTabs?: boolean; forceNewlineEnding?: boolean; }[], Ast.Root, string>
function unifiedLatexStringCompiler(options: {
pretty?: boolean;
printWidth?: number;
useTabs?: boolean;
forceNewlineEnding?: boolean;
}): void;
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 |
PluginOptions
export type PluginOptions =
| {
pretty?: boolean;
printWidth?: number;
useTabs?: boolean;
/**
* If true, formatted code always ends with a newline character.
*/
forceNewlineEnding?: boolean;
}
| undefined;
Generated using TypeDoc