Getting Started

Introduction

Comark extends standard Markdown with component syntax, parses it to a compact AST at build time or runtime, and renders it with Vue, React, Svelte, Angular, HTML or ANSI.

What is Comark?

Comark stands for Components in Markdown. It's an extension of the Markdown syntax that lets you use components directly inside your Markdown content:

# Welcome to my blog

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

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

The ::alert is a block component that supports properties and children (also known as slots).

Learn why we created Comark and the principles behind its design in Why Comark.

Comark parses this into an AST that can be rendered to HTML. It also supports rendering to Vue, Nuxt, React, Svelte, and Angular, turning your Markdown into fully interactive content.

<template>
  <Comark :components="{ Alert }">{{ content }}</Comark>
</template>

<script setup lang="ts">
import Alert from './Alert.vue'

const content = `
# Hello World

::alert{type="info"}
Welcome to Comark!
::
`
</script>

When to Use Comark

Comark is ideal for:

  • Documentation sites - Write docs in Markdown with interactive examples
  • Blog platforms - Rich content with custom components for callouts, embeds, and more
  • AI chat interfaces - Stream and render Markdown responses in real-time
  • CMS integrations - Let content editors use components without touching code
  • Technical writing - Combine prose with live code examples and diagrams

Comparison with Other Tools

For detailed, honest 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

Key Features

Fast Parsing

Built on markdown-exit, producing a compact array-based AST you can cache, serialize, and send over the wire.

Component Syntax

Embed custom components in Markdown with props, slots, and nested children.

Streaming Support

Real-time incremental parsing for AI chat interfaces and live content.

Framework Agnostic

First-class support for Vue, React, Svelte, and Angular with dedicated renderers.

Syntax Highlighting

Built-in Shiki integration for beautiful code blocks with theme support.

GFM Support

Full GitHub Flavored Markdown support including tables, task lists, and more.

FAQ

How It Works

  1. Parse - Comark parses Markdown into a compact Comark AST
  2. Transform - The AST can be manipulated, cached, or serialized
  3. Render - Framework-specific renderers convert the AST to Vue, React, Svelte or Angular components, or render to string in Markdown, HTML or ANSI.