UNPKG

latex-math

Version:

Parses LaTeX math strings—typically extracted from Markdown—and converts them into an abstract syntax tree (AST).

27 lines (26 loc) 936 B
import { Plugin } from "unified"; import * as Ast from "@unified-latex/unified-latex-types"; export type PluginOptions = { mode?: "math" | "regular"; macros?: Ast.MacroInfoRecord; environments?: Ast.EnvInfoRecord; flags?: { /** * Whether to parse macros as if `\makeatletter` is set (i.e., parse `@` as a regular macro character) */ atLetter?: boolean; /** * Whether to parse macros as if `\ExplSyntaxOn` is set (i.e., parse `_` and `:` as a regular macro character) */ expl3?: boolean; /** * Attempt to autodetect whether there are macros that look like they should contain `@`, `_`, or `:`. * Defaults to `false`. */ autodetectExpl3AndAtLetter?: boolean; }; } | undefined; /** * Parse a string to a LaTeX AST. */ export declare const unifiedLatexFromString: Plugin<PluginOptions[], string, Ast.Root>;