comark
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
What is comark?
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.
Overview of comark
What it is
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. It supports CommonMark and GFM, then parses them into a compact, serializable document at build time, runtime, or during a stream. The same document can be used across renderers, or the syntax can be extended with readable components and attributes when richer content is needed.
Key features
- Runtime parsing:
parseMarkdown(markdown)is a pure function returning a compact, serializable Markdown document. Content from a database, CMS, or LLM is live the moment it is saved. No rebuild, no redeploy. - Streaming built in: auto-close completes unterminated syntax (
**bold, open code fences, half-open components) so AI output renders correctly at every frame. - One parser, every renderer: the same source renders to HTML, ANSI, Vue, React, Svelte, and Angular. Your content outlasts your framework.
- Still just Markdown: CommonMark + GFM (with a few differences), frontmatter, and
{.class}attributes on native elements. Components are opt-in syntax, not a new language. - Plugin ecosystem: Shiki highlighting, KaTeX math, Mermaid diagrams, TOC, alerts, footnotes and more, plus compatibility with existing markdown-it plugins.
- Decoupled parse & render: parse once on the server, send the serializable document (
['tag', props, ...children]) to the client, render without re-parsing. - Fast: built on markdown-exit, a TypeScript rewrite of markdown-it, with full TypeScript support.
Use cases
Comark is designed for rendering AI chat output in real time, where streaming Markdown must be displayed correctly as it arrives. It can also be used for any application that needs to parse and render Markdown across multiple frameworks (React, Vue, Svelte, Angular, HTML, terminal) from a single source, such as content from a database, CMS, or LLM. The decoupled parse-and-render model allows parsing on the server and rendering on the client without re-parsing.
Getting started
bashnpm install comark``````tsimport { parseMarkdown } from 'comark'const tree = await parseMarkdown('# Hello **World**')// { nodes: [['h1', { id: 'hello' }, 'Hello ', ['strong', {}, 'World']]], frontmatter: {}, meta: {} }Then pick a renderer (e.g., Vue, React, Svelte, Angular, HTML) by installing the corresponding package (e.g., @comark/vue, @comark/react, @comark/svelte, @comark/angular, @comark/html). See the repository README for full examples.
License and pricing
Comark is published under the MIT License. It is open-source and free to use.
Based on the project's public README and repository metadata.