The interface for a LaTeX typesetter.

interface ILatexTypesetter {
    mathParseOptions?: IRenderMime.ILatexTypesetter.IMathParseOptions;
    typeset(element: HTMLElement): void | Promise<void>;
    withParseOptions(
        options: IRenderMime.ILatexTypesetter.IMathParseOptions,
    ): IRenderMime.ILatexTypesetter;
}

Hierarchy (View Summary)

Properties

Options describing how math is recognized in the source text.

These options are shared with the Markdown pre-processing step (removeMath) so that hiding math from the Markdown parser and typesetting it stay consistent. When omitted, the default options are assumed, including a single $ delimiter for inline math.

Methods

  • Typeset a DOM element.

    Parameters

    • element: HTMLElement

      the DOM element to typeset. The typesetting may happen synchronously or asynchronously.

    Returns void | Promise<void>

  • Create a typesetter of the same kind, using the given parse options.

    This allows extensions to adjust how math is recognized without hard-coding a specific implementation, so that the typesetter chosen by the user (e.g. KaTeX rather than MathJax) is respected:

    const typesetter = rmRegistry.latexTypesetter;
    const latexTypesetter =
    typesetter?.withParseOptions?.({ dollarInlineMath: false }) ?? typesetter;
    const renderer = rmRegistry
    .clone({ latexTypesetter })
    .createRenderer('text/markdown');

    Implementing this method is optional; callers should fall back to the original typesetter when it is not available.

    Parameters

    Returns IRenderMime.ILatexTypesetter

    A new typesetter; this typesetter is left unchanged.