Comark: Markdown Parser and Renderer for Any Framework
The Markdown parser and renderer for everything.
Open-source Markdown parser and renderer with components, attributes, and plugins. Streams AI output to React, Vue, Svelte, Angular, HTML, and the terminal. Get started View on GitHub source.md preview Open in playground## Hello World
A JavaScript library to **parse and render Markdown** anywhere.
```ts
import { parseMarkdown } from 'comark'
const doc = await parseMarkdown('# Hello **World**')
```
## Features
- CommonMark and GFM support
- HTML, ANSI, and framework renderers
- Streaming, components, and plugins
::callout{icon="i-lucide-info"}
Built on markdown-exit, a TypeScript rewrite of markdown-it.
::
// Renderers //
Parse once, render anywhere
Comark parses Markdown into a compact MarkdownDocument . Parse on the server, during a build, or as content streams in, then render it natively in your framework. Your content outlasts your stack.
Markdown component in a template. Custom components and plugins are props.
Card link
Svelte
Native Svelte 5 rendering with runes. No wrapper framework, no {@html}.
Card link
// Streaming //
Built for AI output
A model streams Markdown a few characters at a time. Render it as it lands and your users watch raw asterisks appear, code fences hang open, and the layout jump on every token. Comark closes what is still open, so every frame renders as finished markup.
// Plugins //
Use official plugins, or write your own
Official plugins add syntax highlighting, math, diagrams, table of contents, and more. Write your own against the plugin API or browse all plugins .
highlight.tsimport { parseMarkdown } from 'comark'
import shiki from '@comark/plugin-shiki'
import githubDark from '@shikijs/themes/github-dark'
import githubLight from '@shikijs/themes/github-light'
const document = await parseMarkdown(content, {
plugins: [
shiki({
themes: { light: githubLight, dark: githubDark }
})
]
})
// Syntax //
Co mponents in Mark down
Components, attributes, and frontmatter are opt-in syntax handled by default plugins you can turn off. CommonMark and GFM work by default, so your existing Markdown files parse without changes.
components.md::alert{type="info"}
This is an **important** message.
::
::card{title="My Card"}
Card content with **Markdown** support.
::
Click the :button[Submit]{type="primary"} to continue.
// FAQ //