Comark vs Streamdown

Streamdown streams Markdown in React. Comark streams Markdown with custom component syntax in Vue, React, Svelte, and Angular, with a decoupled parser and serializable AST.

TL;DR: Streamdown is Vercel's React component for streamed LLM Markdown. Comark also completes unfinished syntax during streaming, and adds plain-text component syntax, a standalone parser with a JSON-safe document, and renderers for Vue, React, Svelte, Angular, HTML, and the terminal.

At a glance

ComarkStreamdown
Streams incomplete MarkdownYes, auto-close on every parseYes, remend completes syntax before parsing
Custom components in contentYes, ::alert{type="info"} syntaxNo, element remapping only
FrameworksVue, React, Svelte, Angular, Nuxt, HTML, ANSIReact only
Parse and render splitDecoupled, AST is serializableCoupled, rendering component
Syntax highlightingShiki pluginShiki plugin (@streamdown/code)
MathKaTeX pluginKaTeX plugin (@streamdown/math)
MermaidMermaid pluginMermaid plugin (@streamdown/mermaid)
Security hardeningSecurity pluginrehype-sanitize and rehype-harden on by default
AI SDK integrationWorks with useChat and Chat in any frameworkBuilt around @ai-sdk/react

Same problem, different scope

LLMs stream Markdown token by token, while standard renderers expect complete documents. Both Streamdown and Comark's auto-close step close unfinished bold markers, open code fences, and partial links before each render.

The difference is scope. Streamdown is a React rendering component. Comark is a parser with renderers on top:

import { parseMarkdown } from 'comark'

// Runs on the server, in a worker, or in the browser
const tree = await parseMarkdown(partialMarkdown, { autoClose: true })

That split lets you parse AI output on the server and stream the AST, cache parsed content, post-process it with the AST API, or render the same stream in a terminal with @comark/ansi.

Components in the stream

With Streamdown, the model writes standard Markdown and you map HTML tags to styled elements. With Comark, the model can also write component syntax in plain text:

Here are your flight options:

::flight-card{airline="United" from="SFO" to="JFK" price="342"}
Departs 8:15 AM, nonstop, 5h 30m.
::

Want me to book one of these?

The renderer looks up flight-card in your components map and mounts your component while the message streams:

import { Markdown } from '@comark/react'

<Markdown streaming={isStreaming} components={{ FlightCard }}>
  {message.text}
</Markdown>

Because ::flight-card is text rather than JSX, component syntax runs no code. A tag with no registered component renders as a plain element with the same name. Add the security plugin with a blockedTags list to remove raw HTML tags such as <script> from model output.

Beyond React

Streamdown targets React only. Comark ships the same streaming behavior for Vue, React, Svelte, Angular, and Nuxt, plus string renderers for HTML and ANSI.

What Streamdown does well

  • Built-in chat controls and sanitization: rehype-sanitize, rehype-harden, copy and download buttons, table export, and link confirmation modals come preconfigured. With Comark, you add sanitization and highlighting through plugins.
  • Drop-in API for react-markdown users: Streamdown mirrors the react-markdown props API.

If you're building a React-only chat UI on @ai-sdk/react and don't need custom components in model output, Streamdown requires less setup.

FAQ

© 2026 Vercel, Inc.