What Is Comark? Markdown Parser and Renderer

Comark is an open-source Markdown parser and renderer with components, attributes, and plugins. It streams AI output to React, Vue, Svelte, Angular, HTML, and the terminal.

Comark is an open-source Markdown parser and renderer with components, attributes, and plugins. It streams AI output to React, Vue, Svelte, Angular, HTML, and the terminal. Give it CommonMark or GitHub Flavored Markdown (GFM), and render the same source to any of these targets.

Parsing and rendering are decoupled through a compact, serializable MarkdownDocument. Parse on the server, in the browser, in a worker, during a build, or as content streams in. You can then inspect, transform, cache, serialize, or render the document without tying your content to one output target.

Comark is built on markdown-exit, a TypeScript rewrite of markdown-it that preserves its plugin API. It adds streaming support, a plugin system, and optional component and attribute syntax.

Start with the renderer that matches your output:

import { renderHtml } from '@comark/html'

const content = '# Hello **World**'
const html = await renderHtml(content)
Learn why we created Comark and the principles behind its design in Why Comark.

How it works

The following diagram shows how Comark parses Markdown once and renders the resulting document to each target:

  1. Parse: Comark parses Markdown into a compact MarkdownDocument.
  2. Transform: inspect, transform, cache, or serialize the document.
  3. Render: convert the document to HTML, ANSI, Markdown, Vue, React, Svelte, or Angular.

Extend Markdown when needed

Plain Markdown works without any component syntax. When your content needs custom UI, Comark adds components and attributes without embedding verbose HTML or executable framework code:

# Welcome to my blog

This is regular **Markdown** with a custom component:

::alert{type="warning"}
This is an important message!
::

The ::alert block supports properties, children, and named slots. The renderer only uses components you explicitly register, so the source remains portable data rather than framework-specific code. Learn more in Component syntax and Attributes.

Editor and browser extensions for Comark syntax:

When to use Comark

Use Comark when your project needs any of the following:

  • Content platforms: parse Markdown from files, databases, APIs, or a CMS at build time or runtime.
  • Multi-target publishing: render one source to web apps, static HTML, RSS, email, and terminal output.
  • AI chat interfaces: stream and render incomplete Markdown responses as tokens arrive.
  • Documentation and blogs: combine CommonMark and GFM with callouts, embeds, diagrams, and interactive UI.
  • Content pipelines: inspect, transform, cache, or serialize a compact document before rendering.

Comparison with other tools

For detailed comparisons, see Comark vs MDX, Comark vs react-markdown, Comark vs Streamdown, and Comark vs Markdoc.

FeatureComarkStreamdownMDXMarkdoc
Streaming support
Component syntax
Vue support
React support
Svelte support
Angular support
No build step
Parse to AST
Compact AST
Auto-close for streams
Decoupled parsing & rendering

Core capabilities

CommonMark and GFM

Parse standard Markdown syntax, including tables, task lists, and code blocks.

Parse once, render anywhere

Produce a compact document you can inspect, cache, serialize, and render to every supported target.

Streaming support

Incremental parsing and auto-close for AI chat interfaces and live content.

Plugin ecosystem

Extend parsing with Comark plugins or reuse plugins written for markdown-it.

Component syntax

Add props, slots, and nested UI while keeping content as plain text.

Dedicated renderers

Render to HTML, ANSI, Vue, React, Svelte, and Angular without changing the source.

FAQ

© 2026 Vercel, Inc.