Skip to content

4.2.0

Latest

Choose a tag to compare

@beynar beynar released this 14 Sep 23:15
· 6 commits to master since this release

Feature release: the five items from the September upstream audit judged worth porting. Every new prop defaults to off; the only 4.1.1 renders that change are the two noted below.

⚠️ Behaviour changes

  • The table toolbar has a third action, so turning copy and download off no longer removes the bar; add fullscreen: false or use { table: false }.
  • The exported parseIncompleteMarkdown strips a half-typed HTML tag by default (live defaults to true); pass { live: false } for finished text. Streamdown passes it for you: only the last block is live, and only its last line is ever cut. A sealed block no longer loses an incomplete PascalCase tag either.
  • markedMdx is now a factory; only deep imports are affected.

🧩 Custom tags and literal content

<ai-thinking>**bold**</ai-thinking> used to lex as one raw HTML block. Lowercase and hyphenated names are accepted through an explicit allowlist — customTags, plus the keys of mdxComponents — never by relaxing the regex, so nothing you write today changes meaning. literalTagContent lists tags whose children are a single text token (<mention>@_name_</mention> renders @_name_) and allows the tag on its own. Attribute names may contain hyphens. One compiled matcher per allowlist, shared by lexer and completer.

🏷️ Half-typed tags no longer flash while streaming

Hello <div cla rendered as text on every chunk until the > arrived: 56 frames of visible tag source in a character-by-character stream, now none. Two guards upstream lacks: only the live block's last line is touched, and only a plausible name followed only by attributes — so 3 < 5, `<div`, a fenced <div, and prose like if a <b then survive everywhere.

📐 normalizeHtmlIndentation

Opt-in: dedents pretty-printed HTML before parsing so a nested tag indented four spaces after a blank line is not read as an indented code block. <pre> and <code> bodies are never touched. Also exported as a function.

🔳 Table fullscreen

An expand toggle next to copy and download lifts the wrapper to the whole viewport with the toolbar still usable; Escape or the close button collapses it and returns focus. Labelled role="dialog" while expanded. New: controls.table.fullscreen, icons.close, theme.table.expanded, and translation keys. The global [data-expanded='true'] rule now lives in Streamdown, so it exists on pages without a diagram.

🔢 Code line numbers

lineNumbers (default off) via a CSS counter on the existing line span: zero extra DOM, and the numbers are pseudo-content so copy, download and selection give you only the code. startLine=N in the fence meta sets the first number; lineNumbers / noLineNumbers meta override per block.

Tests 843 → 912 node, 43 → 63 browser; svelte-check 0; size budgets unchanged.

Ported from vercel/streamdown b392fbe, fb9f97c, 3e6a77d, 7f9127b, fb76275, d6666b6, 57cd3b5.