---
title: "Comark vs Streamdown"
description: "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."
canonical_url: "https://comark.dev/compare/comark-vs-streamdown"
---
# 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](https://github.com/vercel/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

|                              | Comark                                                                    | Streamdown                                          |
| ---------------------------- | ------------------------------------------------------------------------- | --------------------------------------------------- |
| Streams incomplete Markdown  | Yes, [auto-close](https://comark.dev/reference/auto-close) on every parse | Yes, `remend` completes syntax before parsing       |
| Custom components in content | Yes, `::alert{type="info"}` syntax                                        | No, element remapping only                          |
| Frameworks                   | Vue, React, Svelte, Angular, Nuxt, HTML, ANSI                             | React only                                          |
| Parse and render split       | Decoupled, AST is serializable                                            | Coupled, rendering component                        |
| Syntax highlighting          | Shiki plugin                                                              | Shiki plugin (`@streamdown/code`)                   |
| Math                         | KaTeX plugin                                                              | KaTeX plugin (`@streamdown/math`)                   |
| Mermaid                      | Mermaid plugin                                                            | Mermaid plugin (`@streamdown/mermaid`)              |
| Security hardening           | [Security plugin](https://comark.dev/plugins/built-in/security)           | `rehype-sanitize` and `rehype-harden` on by default |
| AI SDK integration           | Works with `useChat` and `Chat` in any framework                          | Built 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](https://comark.dev/reference/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:

```ts
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](https://comark.dev/plugins/custom/ast-api), or render the same stream in a terminal with [`@comark/ansi`](https://comark.dev/rendering/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:

```mdc
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:

```tsx
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](https://comark.dev/plugins/built-in/security) 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](https://comark.dev/rendering/vue), [React](https://comark.dev/rendering/react), [Svelte](https://comark.dev/rendering/svelte), [Angular](https://comark.dev/rendering/angular), and [Nuxt](https://comark.dev/rendering/vue#nuxt), plus string renderers for [HTML](https://comark.dev/rendering/html) and [ANSI](https://comark.dev/rendering/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](https://comark.dev/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

::accordion
  :::accordion-item{label="Can Comark render AI responses with interactive components?"}
  Yes. Give the model `::component` syntax in your system prompt, register the components in the renderer, and they render live during streaming. See [streaming in React](https://comark.dev/rendering/react#streaming) or [Vue](https://comark.dev/rendering/vue#streaming).
  :::

  :::accordion-item{label="Is component syntax in LLM output safe?"}
  Component syntax is data, not code. The renderer only mounts components that you register. Add the [security plugin](https://comark.dev/plugins/built-in/security) with a `blockedTags` list to strip risky tags, unsafe URLs, and event handler attributes from untrusted output.
  :::

  :::accordion-item{label="Does Comark work with the Vercel AI SDK?"}
  Yes. Pass `useChat` message text to `<Markdown streaming>` in React, or the equivalent in Vue, Svelte, and Angular. Try it live in the [streaming playground](https://comark.dev/stream).
  :::

  :::accordion-item{label="Do I need plugins for code highlighting and math?"}
  Yes. [Shiki highlighting](https://comark.dev/plugins/built-in/shiki), [KaTeX math](https://comark.dev/plugins/built-in/math), and [Mermaid](https://comark.dev/plugins/built-in/mermaid) are opt-in plugins so the core bundle stays smaller when you don't use them.
  :::
::

---

- [Streaming API](https://comark.dev/reference/auto-close)
- [Playground](https://comark.dev/stream)


## Sitemap

See the full [sitemap](https://comark.dev/sitemap.md) for all pages.
