latex-math
Version:
Parses LaTeX math strings—typically extracted from Markdown—and converts them into an abstract syntax tree (AST).
27 lines (26 loc) • 1.1 kB
TypeScript
import * as Ast from "@unified-latex/unified-latex-types";
import { Plugin } from "unified";
type PluginOptions = {
/**
* Whether to parse macros as if `\makeatletter` is set (i.e., parse `@` as a regular macro character).
* If this option is true, it disables autodetect.
*/
atLetter?: boolean;
/**
* Whether to parse macros as if `\ExplSyntaxOn` is set (i.e., parse `_` and `:` as a regular macro character)
* If this option is true, it disables autodetect.
*/
expl3?: boolean;
/**
* Attempt to autodetect whether there are macros that look like they should contain `@`, `_`, or `:`.
* Defaults to `true`.
*/
autodetectExpl3AndAtLetter?: boolean;
} | undefined;
/**
* Unified plugin to reprocess macros names to possibly include `@`, `_`, or `:`.
* This plugin detects the `\makeatletter` and `\ExplSyntaxOn` commands and reprocesses macro names
* inside of those blocks to include those characters.
*/
export declare const unifiedLatexProcessAtLetterAndExplMacros: Plugin<PluginOptions[], Ast.Root, Ast.Root>;
export {};