Comark vs react-markdown

Comark adds component syntax, streaming auto-close, and multi-framework rendering that react-markdown lacks. Compare architecture, component mapping, and streaming behavior.

TL;DR: react-markdown renders standard Markdown to React elements and maps HTML tags to components. Comark supports the same tag mapping, and adds component syntax in Markdown, autoClose for streamed LLM output, a serializable document for server parsing, and renderers for Vue, Svelte, Angular, HTML, and the terminal.

At a glance

Comarkreact-markdown
Runtime parsingYesYes
Remap h1, a, code to componentsYes, components mapYes, components prop
Custom components in the contentYes, ::alert{type="info"}No, element remapping only
Streaming incomplete MarkdownautoClose completes syntax on every parseUnclosed syntax shows raw markers until complete
FrameworksVue, React, Svelte, Angular, Nuxt, HTML, ANSIReact only
Parse and render splitDecoupled, parse on server and render on clientCoupled, parsing happens inside the component
Underlying parsermarkdown-exit (markdown-it compatible)remark (unified)
PluginsComark plugins and markdown-it pluginsremark and rehype plugins
FrontmatterParsed by default into document.frontmatterRequires remark-frontmatter and custom handling

Element mapping works the same way

If you use react-markdown to replace HTML elements with React components, the components prop works the same way:

import Markdown from 'react-markdown'

<Markdown
  components={{
    a: (props) => <Link {...props} />,
    code: (props) => <CodeBlock {...props} />,
  }}
>
  {markdown}
</Markdown>

What react-markdown can't express

react-markdown maps existing HTML elements to components. It has no syntax for components without an HTML tag, such as a callout, a tabbed code group, or a video embed. Adding raw HTML with rehype-raw brings back HTML verbosity and widens the sanitization surface.

Comark defines components in Markdown:

::alert{type="warning"}
This is **Markdown** inside a component, with nested Markdown support.
::

Status: :badge[Active]{color="green"}

Writers, CMS editors, and language models write plain text instead of JSX or HTML. See component syntax.

Streaming

react-markdown expects a complete document. During a token stream, unclosed asterisks, lists, and code fences render as raw text until their closing markers arrive. Vercel built Streamdown for that reason.

Auto-close completes unfinished syntax on every parse, and the streaming prop reuses completed blocks while tokens arrive:

import { Markdown } from '@comark/react'

export function Message({ text, isStreaming }: { text: string, isStreaming: boolean }) {
  return <Markdown streaming={isStreaming}>{text}</Markdown>
}

Decoupled parsing

react-markdown parses Markdown inside the React component on every client that renders it. Comark separates parsing from rendering so you can parse once on the server, at build time, or in a worker, and render the compact AST anywhere:

server.ts
import { parseMarkdown } from 'comark'

const document = await parseMarkdown(markdown) // cache, store, or serialize as JSON
client.tsx
import { MarkdownDocument } from '@comark/react'

<MarkdownDocument value={document} components={{ Alert }} />

The document contains tuples such as ['h1', { id: 'hello' }, 'Hello'], which serialize directly as JSON. See the document model.

What react-markdown does well

  • The unified ecosystem: react-markdown runs remark and rehype plugins directly. Comark uses its own plugin API and markdown-it parsing plugins, so check that the plugins you rely on have equivalents before switching.
  • Safe defaults and adoption: react-markdown strips raw HTML by default without extra plugins, and has years of production use across React apps.

If you render complete, standard Markdown in a React-only app and rely on remark or rehype plugins, stick with react-markdown.

FAQ

© 2026 Vercel, Inc.