Skip to content

3.0.0

Latest

Choose a tag to compare

@OlgaRedozubova OlgaRedozubova released this 25 Jun 09:51
9a72db2

A major release. It changes the default handling of double-backslash math delimiters (a breaking change) and adds literal \$ rendering in mathescape listings.

Breaking change: mathDelimiterMode now defaults to 'strict'

New option mathDelimiterMode?: 'strict' | 'legacy' controls whether the double-backslash delimiters \\( ... \\) and \\[ ... \\] are treated as math. The default is now 'strict'.

  • 'strict' (default): only single-backslash \( ... \) / \[ ... \] and $ ... $ / $$ ... $$ open math. \\( follows standard CommonMark escaping (\\ → literal \) and renders as literal text.
  • 'legacy': also accepts \\( / \\[ as math openers — the behavior of all 2.x and earlier releases.

Single-backslash \( / \[ and $ / $$ are unchanged in both modes.

Migration

If your content relies on double-backslash delimiters (e.g. pasted or legacy MathJax content), pass 'legacy':

MathpixMarkdownModel.render(text, { mathDelimiterMode: 'legacy' });

The option is honored by markdownToHTML, render, convertToHTML, the <MathpixMarkdown> React component, and the browser auto-render (renderMathInElement / MathpixRenderConfig). Anything other than an explicit 'legacy' falls back to 'strict'.

New: literal \$ in [mathescape=true] listings

Inside a \begin{lstlisting}[mathescape=true] listing, an escaped \$ now renders as a literal $; only a bare $ toggles math. A run of backslashes before $ drops exactly one (\$$, \\$\$). Copy-to-clipboard and string conversion use a math-aware representation, so copied output matches what is displayed. \( / \[ / \\( / \\[ handling is unchanged.

Full changes

See #418 and #419.