Skip to content

4.1.0

Choose a tag to compare

@beynar beynar released this 14 Sep 15:35
· 11 commits to master since this release

Feature release: the LaTeX math delimiters LLMs actually emit, an incomplete signal for the block still streaming, a controls umbrella that configures the toolbars instead of only switching them off, height caps with pinned auto-scroll, a full accessibility and translation pass, and a completer that no longer goes quadratic on a long line.

⚠️ Behaviour changes

  • \(…\) and \[…\] are now math everywhere, static rendering included, and an unterminated one is auto-closed while streaming like $/$$ already were. A document that used those sequences as literal-bracket escapes changes appearance; escape the backslash (\\[) to keep it literal.
  • Mermaid downloads are diagram.svg / diagram.png, without the mermaid- prefix, and the base name is configurable.
  • A code or table toolbar with nothing left in it is no longer rendered.

🔢 LaTeX math

Inline \(x^2\) and display \[E = mc^2\] tokenize end to end and render through KaTeX identically to their $ equivalents. The completer treats them as protected context, so a formula no longer leaks a stray _ or *, and \[ … \] is never rewritten into an incomplete-link marker.

⚡ The completer is linear on long lines

A 16 KB line of unclosed brackets took 116 seconds and now takes 0.6 ms. The underscore and superscript scans were quadratic too. No allocation was added to the hot path; the streaming benchmark is unchanged or slightly faster.

🔁 Streaming signals

  • An incomplete flag for the block whose fence is still open, exposed on the code and mermaid snippets, on custom components, and as data-incomplete for CSS. Mermaid uses it to stop re-rendering a half-written diagram on every chunk.
  • parseBlocks probes every sealed block start before reusing its cache, catching the realistic edit-then-append case. The remaining contract is documented in the README.

🎛️ Controls and table export

controls now takes per-action flags, custom download filenames, a CSV separator with a locale-aware auto, TSV export, and a .mmd source download. extractTableData and tableDataToCSV / TSV / Markdown / HTML are exported for custom table snippets. Every previous boolean form resolves identically.

📐 Height caps

codeBlockMaxHeight and tableMaxHeight cap the height and keep the view pinned to the bottom while content streams, until the reader scrolls up.

🌍 Accessibility and translations

Every icon is hidden from the accessibility tree, every icon-only button has a name, copies are announced to screen readers, and the mermaid fullscreen is a real dialog. All 26 control strings go through a new translations.controls namespace, with defaultTranslations exported.

🐛 Also fixed

The documented mermaid snippet never rendered (both branches went through snippets.code); a fence opened inside a list item was invisible to the fence scanner; a bracket inside a math span was treated as a citation opener.

🧰 Tooling

A bundle-size gate runs in CI. Tests 775 → 835 node, 8 → 42 browser.