Module @unified-latex/unified-latex-util-to-string - v1.6.0

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;

Index

Type Aliases

Functions

Generated using TypeDoc