Skip to content

fix: add math support#86

Merged
tylerdave merged 5 commits intomainfrom
math-rendering
Apr 5, 2026
Merged

fix: add math support#86
tylerdave merged 5 commits intomainfrom
math-rendering

Conversation

@tylerdave
Copy link
Copy Markdown
Member

No description provided.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 5, 2026

Docs Site preview: https://964fa568.rockgarden.pages.dev

claude[bot]

This comment was marked as outdated.

claude[bot]

This comment was marked as outdated.

claude[bot]

This comment was marked as outdated.

claude[bot]

This comment was marked as outdated.

Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previously flagged $a increases and $b decreases issue is resolved: allow_space=False rejects any $token as a closing delimiter when the character immediately before it is a space, which covers the vast majority of prose dollar-variable patterns. The new test_dollar_variables_in_prose_not_math test confirms this.

One residual edge case remains (see inline comment), but the implementation is otherwise clean — CDN SRI hashes are present, textContent correctly unescapes HTML entities before passing to KaTeX, and the block class check for display mode is correct.

_md = MarkdownIt("gfm-like", {"html": True, "breaks": True})
footnote_plugin(_md)
tasklists_plugin(_md)
dollarmath_plugin(_md, allow_digits=False, allow_space=False)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug (Previously flagged — partially addressed): allow_space=False fixes the common $a increases and $b decreases case (space before closing $b blocks it), but slash-separated patterns like $HOME/$USER in plain prose are still consumed: the / before $USER is not whitespace, so HOME/ is wrapped as <span class="math inline">. The result with throwOnError: false is a KaTeX error badge rendered inline.

This is narrower than the previously flagged case — it only affects prose where two $identifier tokens are joined by a non-space, non-digit character without backtick quoting. Acceptable as a documented limitation, but worth a note in docs/Markdown Support.md under the Math section (e.g. "Avoid unquoted $var/path patterns in prose; use backticks instead").

@tylerdave tylerdave merged commit b12ca72 into main Apr 5, 2026
7 checks passed
@tylerdave tylerdave deleted the math-rendering branch April 5, 2026 05:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant