
Research
SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains
An emerging npm supply chain attack that infects repos, steals CI secrets, and targets developer AI toolchains for further compromise.
@assistant-ui/react-streamdown
Advanced tools
Streamdown-based markdown rendering for assistant-ui. An alternative to @assistant-ui/react-markdown with built-in syntax highlighting, math, and diagram support.
| Package | Best For |
|---|---|
@assistant-ui/react-markdown | Lightweight, bring-your-own syntax highlighter |
@assistant-ui/react-streamdown | Feature-rich with built-in Shiki, KaTeX, Mermaid |
npm install @assistant-ui/react-streamdown streamdown
For additional features, install the optional plugins:
npm install @streamdown/code @streamdown/math @streamdown/mermaid @streamdown/cjk
import { StreamdownTextPrimitive } from "@assistant-ui/react-streamdown";
// Inside a MessagePartText component
<StreamdownTextPrimitive />
import { StreamdownTextPrimitive } from "@assistant-ui/react-streamdown";
import { code } from "@streamdown/code";
import { math } from "@streamdown/math";
import { mermaid } from "@streamdown/mermaid";
import "katex/dist/katex.min.css";
<StreamdownTextPrimitive
plugins={{ code, math, mermaid }}
shikiTheme={["github-light", "github-dark"]}
/>
If you're migrating from @assistant-ui/react-markdown, you can use the compatibility API:
import { StreamdownTextPrimitive } from "@assistant-ui/react-streamdown";
// Your existing SyntaxHighlighter component still works
<StreamdownTextPrimitive
components={{
SyntaxHighlighter: MySyntaxHighlighter,
CodeHeader: MyCodeHeader,
}}
componentsByLanguage={{
mermaid: { SyntaxHighlighter: MermaidRenderer }
}}
/>
| Prop | Type | Description |
|---|---|---|
mode | "streaming" | "static" | Rendering mode. Default: "streaming" |
plugins | PluginConfig | Streamdown plugins (code, math, mermaid, cjk) |
shikiTheme | [string, string] | Light and dark theme for Shiki |
components | object | Custom components including SyntaxHighlighter and CodeHeader |
componentsByLanguage | object | Language-specific component overrides |
preprocess | (text: string) => string | Text preprocessing function |
controls | boolean | object | Enable/disable UI controls for code blocks and tables |
containerProps | object | Props for the container div |
containerClassName | string | Class name for the container |
remarkRehypeOptions | object | Options passed to remark-rehype during processing |
BlockComponent | React.ComponentType | Custom component for rendering blocks |
parseMarkdownIntoBlocksFn | (md: string) => string[] | Custom block parsing function |
remend | object | Incomplete markdown auto-completion config |
linkSafety | object | Link safety confirmation config |
mermaid | object | Mermaid diagram rendering config |
allowedTags | object | HTML tags whitelist |
remend for better streaming performance@streamdown/code pluginmode and isAnimatingUse BlockComponent to customize how individual markdown blocks are rendered:
<StreamdownTextPrimitive
BlockComponent={({ content, index }) => (
<div key={index} className="my-block">
{/* Custom block rendering */}
</div>
)}
/>
Override the default block splitting logic:
<StreamdownTextPrimitive
parseMarkdownIntoBlocksFn={(markdown) => markdown.split(/\n{2,}/)}
/>
import {
useIsStreamdownCodeBlock,
useStreamdownPreProps,
} from "@assistant-ui/react-streamdown";
// Inside a code component
function MyCodeComponent() {
const isCodeBlock = useIsStreamdownCodeBlock();
const preProps = useStreamdownPreProps();
if (!isCodeBlock) {
return <code className="inline-code">...</code>;
}
return <pre {...preProps}>...</pre>;
}
Use memoized components: Custom SyntaxHighlighter and CodeHeader components should be memoized to avoid unnecessary re-renders.
Avoid inline function props: Define preprocess, parseMarkdownIntoBlocksFn, and other callbacks outside the render function or wrap them in useCallback.
Plugin configuration: Pass plugin objects by reference (not inline) to prevent recreation on each render.
// Good
const plugins = useMemo(() => ({ code, math }), []);
<StreamdownTextPrimitive plugins={plugins} />
// Avoid
<StreamdownTextPrimitive plugins={{ code, math }} />
MIT
FAQs
Streamdown-based markdown rendering for assistant-ui
The npm package @assistant-ui/react-streamdown receives a total of 794 weekly downloads. As such, @assistant-ui/react-streamdown popularity was classified as not popular.
We found that @assistant-ui/react-streamdown demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
An emerging npm supply chain attack that infects repos, steals CI secrets, and targets developer AI toolchains for further compromise.

Company News
Socket is proud to join the OpenJS Foundation as a Silver Member, deepening our commitment to the long-term health and security of the JavaScript ecosystem.

Security News
npm now links to Socket's security analysis on every package page. Here's what you'll find when you click through.