Skip to content

0.9.24

Choose a tag to compare

@github-actions github-actions released this 05 May 00:59
33aecdb

Bug fixes

  • Fix math formulas not rendering inside HTML blocks (e.g. $a^2+b^2=c^2$ inside <table><tr><td>…</td></tr></table>). Markdown-it treats a top-level HTML block as verbatim content, so the inline math rule never saw the formula. The math plugin now also hooks md.renderer.rules.html_block and post-processes the rendered HTML for math delimiters, skipping content inside <code>, <pre>, <script>, and <style> tags so embedded code samples that legitimately contain $x$ literals aren't rewritten. Inline HTML wrappers (<span>$x$</span>) already worked because markdown-it's inline parser splits around the tag — this fix only touches the block path. Works for both mathRenderingOption: 'KaTeX' (server-rendered) and 'MathJax' (emits <span class="mathjax-exps"> placeholders the client-side script picks up), and respects user-configured mathInlineDelimiters / mathBlockDelimiters (e.g. \(…\) / \[…\] instead of the default $…$ / $$…$$). Fixes vscode-mpe#2280.

Internal

  • Added 15 new math-rendering tests in test/math.test.ts covering: inline / block math, the vscode-mpe#2280 reproducer (table + <td>$x$</td>), block math inside <div>, multiple formulas in one HTML block, code/pre skip behaviour, mathRenderingOption: 'None' no-op, unmatched delimiter handling, the inline-HTML-wrapper path that previously worked, MathJax placeholder shape (span + div forms), and custom \(…\) / \[…\] delimiter configurations (including a no-fallback assertion that a literal $5 to $10 doesn't trigger math when only custom delimiters are configured).