1.8.2 • Published 4 months ago

@unified-latex/unified-latex-util-to-string v1.8.2

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

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

ParamType
astAst.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;
1.8.2

4 months ago

1.8.1

8 months ago

1.8.0

10 months ago

1.7.1

1 year ago

1.7.0

1 year ago

1.6.1

1 year ago

1.6.0

1 year ago

1.4.2

2 years ago

1.4.1

2 years ago

1.4.0

2 years ago

1.3.2

2 years ago

1.3.1

2 years ago

1.3.0

2 years ago

1.2.2

2 years ago

1.2.0

3 years ago

1.1.0

3 years ago

1.2.1

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.9

3 years ago

1.0.12

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.0

3 years ago