feat!: adopt @tanstack/markdown 1.0 inlineParser API (v1.0.0) - #10
Merged
Merged
Conversation
Replace the inline text-walker with an inlineParser ('$' marker) using
pandoc-style rules, simplify the default renderer (shared with React),
harden the block extension (indent limit, unclosedBlock option) and
trim TeX consistently in both output modes.
BREAKING CHANGE: peer dependency minimum raised to @tanstack/markdown 1.0.0.
How to migrate: run `pnpm add @tanstack/markdown@^1 tanstack-markdown-math@^1`
(or the npm/yarn equivalent).
BREAKING CHANGE: heading slugs change when headings contain inline math.
How to migrate: regenerate any stored heading anchors, table-of-contents
entries and deep links for headings that contain `$...$`.
BREAKING CHANGE: default error output now uses English text and neutral CSS
classes (katex-error-badge / katex-error-box).
How to migrate: replace styling that targeted the old Tailwind classes or
French strings with CSS for `katex-error-badge` / `katex-error-box`, or pass
a custom `render` option to keep your previous markup.
BREAKING CHANGE: protectMath and restoreMathChars are deprecated.
How to migrate: remove protectMath(content) calls before parsing; math with
`_`, `*` and `\` works without it. Both functions stay exported for
already-protected content.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Rewrite of the inline math pipeline on the new
@tanstack/markdown1.0inlineParserAPI ($marker, pandoc-style rules). Deletes theprotectMath/PUA-substitution workaround machinery (~200 lines), shares one render path betweenhtmlmode and React, hardens the block extension, and adds 25 tests.Fixed by the rewrite (verified)
\$a\$no longer renders as math (escaped$handled by the parser, before emphasis/escapes)$5-$10 rangeno longer split into math (pandoc rule: closing$not followed by a digit)$a*b*c$,$x_{i}*y_{j}$,$\{a\}\\ b$work withoutprotectMath— raw source is seen before emphasis handling$a \$ b$is now valid math (escaped$inside body)$$no longer stolen as math (was^\s*\$\$→^ {0,3}\$\$)New
unclosedBlock: falseoption: unclosed$$stays literal text instead of swallowing the documentkatex-error-badge/katex-error-boxBreaking changes — how to migrate
@tanstack/markdown>= 1.0.0 →pnpm add @tanstack/markdown@^1 tanstack-markdown-math@^1(or npm/yarn equivalent). Stay ontanstack-markdown-math@0.xto keep markdown 0.0.x.$...$.renderoption.protectMath/restoreMathCharsdeprecated (still exported) → removeprotectMath(content)calls before parsing; already-protected content keeps working.Validation
typecheck ✅ · 113/113 tests ✅ · build ✅ · behavioral smoke suite on built dist ✅ (escaped
$, currency, unprotected TeX, no-mutation re-parse)