@@ -20,6 +20,43 @@ export type TrustContext =
2020 | { command : "\\htmlStyle" , style : string }
2121 | { command : "\\htmlData" , attributes : Record < string , string > }
2222
23+
24+ export type Catcodes = Record < string , number > ;
25+
26+ export interface Lexer {
27+ input : string ;
28+ tokenRegex : RegExp ;
29+ settings : Required < KatexOptions > ;
30+ catcodes : Catcodes ;
31+ }
32+
33+ export interface SourceLocation {
34+ start : number ;
35+ end : number ;
36+ lexer : Lexer ;
37+ }
38+
39+ export interface Token {
40+ text : string ;
41+ loc : SourceLocation | undefined ;
42+ noexpand ?: boolean ;
43+ treatAsRelax ?: boolean ;
44+ }
45+
46+
47+ export type StrictFunction = (
48+ errorCode :
49+ | "unknownSymbol"
50+ | "unicodeTextInMathMode"
51+ | "mathVsTextUnits"
52+ | "commentAtEnd"
53+ | "htmlExtension"
54+ | "newLineInDisplayMode" ,
55+ errorMsg : string ,
56+ token : Token ,
57+ ) => boolean | "error" | "warn" | "ignore" | undefined ;
58+
59+
2360/**
2461 * Options for `katex.render` and `katex.renderToString`.
2562 * @see https://katex.org/docs/options
@@ -133,7 +170,7 @@ export interface KatexOptions {
133170 strict ?:
134171 | boolean
135172 | "ignore" | "warn" | "error"
136- | ( ( errorCode : string , errorMsg : string , token : object ) => boolean | "ignore" | "warn" | "error" | undefined | null ) ;
173+ | StrictFunction ;
137174 /**
138175 * If `false` (do not trust input), prevent any commands like
139176 * `\includegraphics` that could enable adverse behavior, rendering them
0 commit comments