Skip to content

✨ feat: add remend option to Streamdown - #5

Merged
Innei merged 1 commit into
mainfrom
fix/remend-options
Sep 26, 2026
Merged

Innei merged 1 commit into
mainfrom
fix/remend-options

Conversation

@Innei

@Innei Innei commented Sep 26, 2026

Copy link
Copy Markdown
Member

Problem

The block lexer completes the open tail with remend(rawTail) using remend's defaults. Its HTML-tag step treats a TeX comparison such as p<q as an unfinished tag and drops everything after it. Because frozen blocks stop at the first point where remend changed the text, the rest of the message stays hidden until the stream ends. Callers that never render raw HTML have no way to turn that step off.

Change

  • New remend?: RemendOptions prop on Streamdown, also accepted by useSmoothStreamContent. It is passed to createBlockLexer(remendOptions) in both places the lexer runs (the renderer and the smoother's complete-prefix scan), and made stable with useStableValue, so an inline object does not rebuild the lexer on every render.
  • Defaults are unchanged.
  • README props table documents the option.
<Streamdown content={content} remend={{ htmlTags: false }} />

Tests

  • blockLexer.test.ts: the default truncates p<q … input; { htmlTags: false } keeps it intact.
  • Streamdown.test.tsx: the rendered text keeps the content after p<q with the option set.
  • pnpm test (197 passed), pnpm type-check, pnpm lint.

Downstream: LodyAI/Lody#1002 currently carries a pnpm patch for this and will switch to the prop once released.

Pass RemendOptions to the tail completion pass in both the renderer and the smoothing hook. With default options, remend treats a comparison such as p<q as an unfinished HTML tag and drops everything after it until the stream ends; callers that do not render raw HTML can now pass { htmlTags: false }.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-26T09:05:26.218310Z 6ee66f1 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying streamdown with  Cloudflare Pages  Cloudflare Pages

Latest commit: 6ee66f1
Status: ✅  Deploy successful!
Preview URL: https://3f1b28c7.streamdown-6nu.pages.dev
Branch Preview URL: https://fix-remend-options.streamdown-6nu.pages.dev

View logs

@Innei
Innei merged commit 950be99 into main Sep 26, 2026
3 checks passed
lobe-tsukumo Bot pushed a commit that referenced this pull request Sep 26, 2026
# [1.4.0](v1.3.1...v1.4.0) (2026-09-26)

### ✨ Features

* Add remend option to Streamdown, closes [#5](#5) ([950be99](950be99))

### 🔧 Continuous Integration

* Publish GitHub releases as lobe-tsukumo App, closes [#3](#3) ([0f9bd45](0f9bd45))
@lobe-tsukumo

lobe-tsukumo Bot commented Sep 26, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 1.4.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Innei added a commit to Innei/Lody that referenced this pull request Sep 26, 2026
… a patch

@lobehub/streamdown 1.4.0 exposes the remend options (lobehub/streamdown#5),
so the streaming renderer passes { htmlTags: false } directly and the pnpm
patch is removed. 1.4.0 is excluded from the minimum release age because it
was adopted on release day.

Refs LodyAI#421

Model: claude-opus-5-5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant