Skip to content

chore(parser): upgrade markdown-it-ts to 1.1.8 - #840

Merged
Simon-He95 merged 1 commit into
mainfrom
chore/upgrade-markdown-it-ts-1.1.8
Nov 20, 2026
Merged

Simon-He95 merged 1 commit into
mainfrom
chore/upgrade-markdown-it-ts-1.1.8

Conversation

@Simon-He95

Copy link
Copy Markdown
Owner

What broke

stream-markdown-parser bundles markdown-it-ts into its dist, so the streaming fix has to be picked up here, not by consumers upgrading markdown-it-ts directly.

markdown-it-ts <= 1.1.7 reparsed the tail of the last top-level block starting from that block's first line. A block rule that emits two top-level blocks from one line — display math followed by the trailing text, as the math rule does for $$x$$ text — therefore re-emitted the math block next to the cached copy. Streaming

Intro

$$E=mc^2$$, where E is energy.

End

one character at a time through parseMarkdownToStructure(prefix, md, { final: false }) produced up to 23 math_block nodes for the single formula.

Change

  • packages/markdown-parser/package.json: markdown-it-ts ^1.1.7 → ^1.1.8, with the matching pnpm-lock.yaml entries (importer, package resolution, snapshot). pnpm install --frozen-lockfile --lockfile-only confirms the lock is consistent.
  • New packages/markdown-parser/test/same-line-math-streaming.test.ts:
    • at most one math_block at every prefix of the document,
    • streamed nodes equal a cold parse at every prefix,
    • the same document delivered in chunks keeps exactly one math_block.

Verification

  • Against the published 1.1.7: all three cases fail (prefix "Intro\n\n$$E=mc^2$$, " → 2 math blocks, streamed ≠ cold).
  • Against the published 1.1.8: all three pass.
  • Full parser suite: 76 files / 874 tests passed.
  • pnpm --filter stream-markdown-parser typecheck and ESLint clean; pnpm --filter stream-markdown-parser build inlines 1.1.8 into dist.

After merge

stream-markdown-parser needs a release (the dist embeds the parser), then markstream-vue can move to it.

markdown-it-ts 1.1.8 fixes the streaming tail segment, which reparsed the
first line of the last top-level block. A plugin rule that emits two blocks
from one line (display math followed by trailing text) therefore re-emitted
the math block on top of the cached copy, so `Intro\n\n$$E=mc^2$$, where E is
energy.\n\nEnd` streamed one character at a time produced up to 23 `math_block`
nodes for the single formula.

Bump the bundled dependency and add a regression test that streams the document
one character at a time (plus a chunked pass) and compares the streamed nodes
with a cold parse. Against markdown-it-ts 1.1.7 all three cases fail; with 1.1.8
they pass.
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying markstream-vue with  Cloudflare Pages  Cloudflare Pages

Latest commit: a06403e
Status: ✅  Deploy successful!
Preview URL: https://9d57e5af.markstream-vue.pages.dev
Branch Preview URL: https://chore-upgrade-markdown-it-ts-yky5.markstream-vue.pages.dev

View logs

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying markstream-vue-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: a06403e
Status: ✅  Deploy successful!
Preview URL: https://f9263a6c.markstream-vue-docs.pages.dev
Branch Preview URL: https://chore-upgrade-markdown-it-ts-4ytk.markstream-vue-docs.pages.dev

View logs

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying markstream-nuxt with  Cloudflare Pages  Cloudflare Pages

Latest commit: a06403e
Status: ✅  Deploy successful!
Preview URL: https://bef3cfa9.markstream-nuxt.pages.dev
Branch Preview URL: https://chore-upgrade-markdown-it-ts-3o7o.markstream-nuxt.pages.dev

View logs

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying markstream-vue2 with  Cloudflare Pages  Cloudflare Pages

Latest commit: a06403e
Status: ✅  Deploy successful!
Preview URL: https://57e0c2f0.markstream-vue2.pages.dev
Branch Preview URL: https://chore-upgrade-markdown-it-ts-g7kf.markstream-vue2.pages.dev

View logs

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying markstream-react with  Cloudflare Pages  Cloudflare Pages

Latest commit: a06403e
Status: ✅  Deploy successful!
Preview URL: https://285c4753.markstream-react.pages.dev
Branch Preview URL: https://chore-upgrade-markdown-it-ts-ywsy.markstream-react.pages.dev

View logs

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying markstream-angular with  Cloudflare Pages  Cloudflare Pages

Latest commit: a06403e
Status: ✅  Deploy successful!
Preview URL: https://920852c7.markstream-angular.pages.dev
Branch Preview URL: https://chore-upgrade-markdown-it-ts-19dl.markstream-angular.pages.dev

View logs

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying markstream-svelte with  Cloudflare Pages  Cloudflare Pages

Latest commit: a06403e
Status: ✅  Deploy successful!
Preview URL: https://b61e57c8.markstream-svelte.pages.dev
Branch Preview URL: https://chore-upgrade-markdown-it-ts-944e.markstream-svelte.pages.dev

View logs

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying markstream-solid with  Cloudflare Pages  Cloudflare Pages

Latest commit: a06403e
Status: ✅  Deploy successful!
Preview URL: https://2f5b6f5b.markstream-solid.pages.dev
Branch Preview URL: https://chore-upgrade-markdown-it-ts.markstream-solid.pages.dev

View logs

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying markstream-octane with  Cloudflare Pages  Cloudflare Pages

Latest commit: a06403e
Status: ✅  Deploy successful!
Preview URL: https://25c3037b.markstream-octane.pages.dev
Branch Preview URL: https://chore-upgrade-markdown-it-ts.markstream-octane.pages.dev

View logs

@Simon-He95
Simon-He95 merged commit 06a8e8f into main Nov 20, 2026
18 checks passed
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