remend@1.4.0

vercel/streamdownremend@1.4.0Sep 30, 2026by github-actions[bot]

Upgrading?

AI Summary

This release focuses on internal performance improvements by reworking the code-region detection logic to use a single-pass scanner, fixing quadratic complexity issues, and correcting handling of double underscores.

Key Highlights

  • A new single-pass scanner handles CommonMark fences and spans, replacing the previous per-character rescans.
  • The release eliminates slow quadratic healing on delimiter-heavy input, improving performance significantly.
  • Identifiers containing double underscores (e.g., `snake__case`) are now handled correctly.
  • Healing logic is now idempotent, meaning re-healing output produces the same result.

New Features

  • Single-pass scanner for code fences and spans with CommonMark compliance.
  • Idempotent healing logic.
  • Fix for incomplete HTML tags inside math expressions.

Full Release Notes

### Minor Changes

- fdd1351: Rework code-region detection and double-underscore counting.

  A shared single-pass scanner now classifies fences and inline code spans, replacing the per-character rescans that made healing quadratic on delimiter-heavy input. Fence and span detection follows CommonMark, so `~~~` fences, fences inside block quotes and list items, CRLF line endings, and multi-backtick spans are all recognized, and content inside code is never healed as prose.

  Double underscores are counted per maximal run with flanking rules, so identifiers containing `__` (like `snake__case`) no longer invent or swallow emphasis closers.

  Healing is now idempotent. Healed output re-heals to itself, and text-only link mode resolves every unmatched bracket in one call.

### Patch Changes

- cf0ac1c: Stop the incomplete-HTML-tag handler from truncating math expressions.

  `handleIncompleteHtmlTag` guarded against code blocks but not math, so an ordinary
  comparison inside math — `$$ I = \sum_{j<k} p_j $$` — matched the incomplete-tag
  pattern and deleted everything from the `<` to the end of the string. The trailing
  `$$` was then auto-closed by the katex handler, so KaTeX rendered a parse error and
  the rest of the message never reached the DOM.

  The handler now skips candidates inside math blocks (`$`, `$$`, `\(`, `\[`), matching
  the guard the emphasis handlers already had. Because the pattern is leftmost-matching,
  it also walks forward to later candidates instead of bailing out, so a genuine
  incomplete tag after a math expression is still stripped.

- e0ce123: Incomplete images during streaming now render a loading placeholder instead of being removed entirely. Incomplete images (e.g. `![alt](https://exampl`) are replaced with `![alt](streamdown:incomplete-image)` by remend, and the streamdown `ImageComponent` renders an animated skeleton for this special URL. This mirrors the existing behavior for incomplete links (`streamdown:incomplete-link`). The `streamdown` protocol is allowlisted for `img[src]` in the default sanitize schema so the sentinel survives rehype-sanitize + rehype-harden.

Related Repositories