mathpix-markdown-it
Version:
Mathpix-markdown-it is an open source implementation of the mathpix-markdown spec written in Typescript. It relies on the following open source libraries: MathJax v3 (to render math with SVGs), markdown-it (for standard Markdown parsing)
21 lines (20 loc) • 844 B
TypeScript
import { TOutputMath } from "../mathpix-markdown-model";
export interface MathpixAccessibilityConfig {
/** Expose MathJax assistive MathML for screen readers */
assistive_mml?: boolean;
/** Add aria-label speech string generated by SRE */
include_speech?: boolean;
}
export interface MathpixRenderConfig {
accessibility: MathpixAccessibilityConfig;
outMath: TOutputMath;
/** Container width used for layout metrics (cwidth) */
width?: number;
previewUuid?: string;
}
/**
* Typeset MathJax math inside a container element.
* Searches for `.math-inline` and `.math-block`, detects whether each node contains pure MathML or TeX,
* and replaces its inner HTML with MathJax output.
*/
export declare const renderMathInElement: (container: HTMLElement, config?: Partial<MathpixRenderConfig>) => Promise<void>;