Member Junction
    Preparing search index...
    Index

    Constructors

    Methods

    • Typeset TeX math in a container: every code.mj-math placeholder that markdown-core's math extension emitted. Call this after the HTML has been inserted into the DOM. MathML that arrived as markup is already rendered by the browser; it only gets the letter fix below.

      The output is MathML, which current browsers lay out natively, so hosts need no KaTeX stylesheet or fonts. KaTeX builds the nodes itself from the TeX text (no HTML string is parsed) and runs with trust off, so \href, \url and \includegraphics stay inert. A formula KaTeX cannot parse, one that defines macros, or an engine that fails to load leaves the TeX source showing as code. User sizes are capped at 20em.

      Whether math is on is the caller's decision (<mj-markdown> checks its EnableMath input): this service is a root singleton whose config the last-rendered component set, so it is no guide to the container in hand. Without math enabled at parse time there are no placeholders.

      Parameters

      • container: HTMLElement

        The DOM element containing the math placeholders

      Returns Promise<boolean>

      true if at least one TeX formula was typeset

    • Sanitize rendered HTML for binding to innerHTML while preserving layout HTML, inline styles and inline SVG. See the DOMPurify configuration at the top of this file for what is kept and removed. Where no DOM is available to sanitize with, the markup is escaped and rendered as text rather than trusted.

      Parameters

      • html: string

      Returns string

    • Spell MathML's styled letters (mathvariant="bold", "double-struck", ...) with their Unicode math characters, which Chrome renders. RenderMath already does this; call it on its own when math is off, because MathML that arrived as markup still renders then.

      Parameters

      • container: HTMLElement

        The DOM element containing the MathML

      Returns void