---
title: "Comark vs Markdoc"
description: "Comark and Markdoc both treat Markdown as data with runtime parsing. Comark adds streaming auto-close, a more compact AST, and renderers for Vue, Svelte, Angular, and ANSI."
canonical_url: "https://comark.dev/compare/comark-vs-markdoc"
---
# Comark vs Markdoc

> Comark and Markdoc both treat Markdown as data with runtime parsing. Comark adds streaming auto-close, a more compact AST, and renderers for Vue, Svelte, Angular, and ANSI.

**TL;DR**: [Markdoc](https://markdoc.dev) (built by Stripe) and Comark both treat Markdown as data, declare components in plain text, and parse at runtime with no build step. Comark adds `autoClose` for streamed AI output, a tuple-based AST, renderers for Vue, React, Svelte, Angular, HTML, and the terminal, and markdown-it plugin support.

## At a glance

|                                    | Comark                                                                                                                              | Markdoc                              |
| ---------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------ |
| Component syntax                   | `::callout{type="note"}`                                                                                                            | `{% callout type="note" %}`          |
| Runtime parsing, no build step     | Yes                                                                                                                                 | Yes                                  |
| Serializable AST                   | Yes, `['tag', props, ...children]`                                                                                                  | Yes, renderable tree of node objects |
| Streaming incomplete input         | `autoClose` on every parse                                                                                                          | Not supported                        |
| Official renderers                 | Vue, React, Svelte, Angular, Nuxt, HTML, ANSI                                                                                       | React, HTML                          |
| Schema validation of tags          | No, components validate their own props                                                                                             | Yes, tag and attribute schemas       |
| Variables and functions in content | Bindings via `:prop="expr"` and `{{ path }}`                                                                                        | Built-in `$variables` and functions  |
| Partials                           | Handled in application code                                                                                                         | Built-in `{% partial %}`             |
| Plugin ecosystem                   | Comark plugins and markdown-it plugins                                                                                              | Custom nodes and tags configuration  |
| Syntax lineage                     | [Markdown directives proposal](https://talk.commonmark.org/t/generic-directives-plugins-syntax/444), 5 years of MDC in Nuxt Content | Stripe's internal docs platform      |

## Shared philosophy

Both libraries avoid compiling Markdown into JavaScript modules. A Markdoc tag and a Comark component are plain-text declarations:

::code-group
```md [Markdoc]
{% callout type="note" %}
Useful information with **Markdown** inside.
{% /callout %}
```

```mdc [Comark]
::callout{type="note"}
Useful information with **Markdown** inside.
::
```
::

Both parse into a serializable tree, resolve components from a runtime map, and run inside a request handler.

## Streaming

Markdoc targets complete documentation files validated against schemas, and doesn't auto-close unfinished syntax.

Comark's [auto-close](https://comark.dev/reference/auto-close) step closes unfinished Markdown and open `::component` blocks on every parse, so streamed LLM output renders frame by frame:

```ts
import { autoCloseMarkdown } from 'comark'

autoCloseMarkdown('::callout\nStreaming in **prog')
// '::callout\nStreaming in **prog**\n::'
```

## AST shape

Comark represents element nodes as compact tuples:

```ts
['callout', { type: 'note' }, ['p', {}, 'Useful information']]
```

Markdoc represents nodes as objects carrying `type`, `tag`, `attributes`, `children`, and transform metadata. Comark's tuple format keeps `JSON.stringify()` payloads compact when sending parsed documents from a server to a client. See the [document model](https://comark.dev/getting-started/document-model).

## Framework coverage

Markdoc officially renders to React and HTML. Comark ships official renderers for [Vue](https://comark.dev/rendering/vue), [React](https://comark.dev/rendering/react), [Svelte](https://comark.dev/rendering/svelte), [Angular](https://comark.dev/rendering/angular), and [Nuxt](https://comark.dev/rendering/vue#nuxt), plus [HTML](https://comark.dev/rendering/html) and [ANSI](https://comark.dev/rendering/ansi) string output, all consuming the same AST.

## What Markdoc does well

- **Schema validation**: Markdoc lets you declare each tag's allowed attributes and children, then validate documents against those schemas before rendering. Comark has no schema layer; components validate their own props, and you write structural checks with the [AST API](https://comark.dev/plugins/custom/ast-api).
- **Built-in variables, functions, and partials**: Markdoc resolves `$variables`, calls functions, and includes partials inside content. Comark keeps logic in the application: the [binding plugin](https://comark.dev/plugins/built-in/binding) interpolates frontmatter and runtime data, and composition happens in your components.

If your documentation team needs pre-render schema checks on every tag and attribute, Markdoc provides that validation layer.

## FAQ

::accordion
  :::accordion-item{label="Is Comark's syntax a standard?"}
  It follows the [generic directives proposal](https://talk.commonmark.org/t/generic-directives-plugins-syntax/444) discussed by the CommonMark community and has been used in production by Nuxt Content's MDC for over five years. Markdoc's `{% %}` syntax is specific to Markdoc.
  :::

  :::accordion-item{label="Can Comark validate content like Markdoc schemas?"}
  Comark doesn't include a built-in schema validator. You can walk the parsed document with `visit()` from the [AST API](https://comark.dev/plugins/custom/ast-api) to check tags and attributes, or validate props inside your components.
  :::

  :::accordion-item{label="How do variables work in Comark?"}
  The [binding plugin](https://comark.dev/plugins/built-in/binding) interpolates `{{ path }}` expressions from frontmatter, meta, or runtime data, and `:prop="expression"` binds dynamic values to component props.
  :::

  :::accordion-item{label="Which is better for documentation sites?"}
  Both work well. Choose Markdoc if editorial schema validation is a hard requirement. Choose Comark if you need Vue, Svelte, or Angular renderers, streaming, or the markdown-it plugin ecosystem.
  :::
::

---

- [Component syntax](https://comark.dev/syntax/components)
- [Playground](https://comark.dev/play)


## Sitemap

See the full [sitemap](https://comark.dev/sitemap.md) for all pages.
