/** * A minimal, dependency-free LaTeX tokenizer for the paper editor's syntax * highlight overlay. Robustness beats completeness: anything unrecognized * stays `plain` — a missed highlight is fine, a misaligned one is not. * Rules: comments run from an unescaped `%` to end of line; commands are * `\letters` with an optional `*`; the environment name inside * `\begin{env}`/`\end{env}` is its own token; `$...$` (same line only) and * `$$...$$` are one math token each, an unclosed `$` falls back to plain; * braces and brackets are single-char tokens; two-character backslash escapes * (`\%`, `\$`, `\\`…) are plain so they never start a comment or command. * @module dsh-client-ui-mimir/client/latex-highlight */ /** Token categories the overlay colors. */ export type LatexTokenType = 'plain' | 'comment' | 'command' | 'math' | 'brace' | 'bracket' | 'env'; /** One token: its category and exact source slice (concatenation reproduces the input). */ export interface LatexToken { readonly type: LatexTokenType; readonly text: string; } /** * Source length above which the editor skips highlighting entirely — the * token list is rebuilt on every keystroke, and a pathological file must not * freeze the panel. */ export declare const HIGHLIGHT_MAX_LENGTH = 200000; /** * Tokenize LaTeX source for the highlight overlay. The concatenation of all * token texts always equals the input, so the overlay can never drift from * the textarea's content. * @param text - the full `main.tex` source. * @returns the token list; adjacent `plain` runs are merged. */ export declare function tokenizeLatex(text: string): LatexToken[]; //# sourceMappingURL=latex-highlight.d.ts.map