New npm package for automatic recovery of broken streaming markdown
Remend is a new standalone npm package that intelligently detects and completes unterminated Markdown blocks during token-by-token AI streaming, ensuring clean and stable rendering output. It works as a pre-processor with any Markdown renderer and handles complex edge cases like unclosed fences, incomplete formatting markers, and nested syntax.
is a new standalone package that brings intelligent incomplete Markdown handling to any application.Remend
Previously part of 's Markdown termination logic, Remend is now a standalone library () you can use in any application.Streamdownnpm i remend
AI models stream Markdown token-by-token, which often produces incomplete syntax that breaks rendering. For example:
Without correction, these patterns fail to render, leak raw Markdown, or disrupt layout:
Remend automatically detects and completes unterminated Markdown blocks, ensuring clean, stable output during streaming.
As the stream continues and the actual closing markers arrive, the content seamlessly updates, giving users a polished experience even mid-stream.
It works with any Markdown renderer as a pre-processor. For example:
Remend powers the markdown rendering in Streamdown and has been battle-tested in production AI applications. It includes intelligent rules to avoid false positives and handles complex edge cases like:
To get started, either use it through or install it standalone with:Streamdown
Why it matters
Unclosed fences
Half-finished bold/italic markers
Unterminated links or lists
Mathematical expressions with underscores in LaTeX blocks
Product codes and variable names with asterisks/underscores
List items with formatting markers
Nested brackets in links
Source: original entry ↗
More from Vercel
Follow Vercel to get its new changes in your feed and email digest.
OpenAI Decisions API now available on AI Gateway
OpenAI's Decisions API is now accessible through Vercel's AI Gateway with an OpenAI-compatible endpoint, enabling decision models to answer typed questions and return probabilities, choices, and scores for routing, triage, and guardrails use cases. Support is available across the OpenAI SDK, AI SDK, HTTP API, and CLI with the latest versions.
Timestamp attributes now supported in Vercel Flags
Vercel Flags now supports timestamp attributes for entities, allowing you to create time-based targeting rules. Use this feature to run limited-time campaigns, show content between specific dates, or target users based on registration date.
Glyph Cluster now available in stealth on AI Gateway
Glyph Cluster, a reasoning model for coding and long-context analysis, is now available as a stealth model on Vercel's AI Gateway for Pro and Enterprise plan teams with purchased AI Gateway credits at no cost during the stealth period. The model supports function calling, streams responses, and can be accessed via AI SDK, OpenAI-compatible APIs, and coding agents.