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 (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

ComarkMarkdoc
Component syntax::callout{type="note"}{% callout type="note" %}
Runtime parsing, no build stepYesYes
Serializable ASTYes, ['tag', props, ...children]Yes, renderable tree of node objects
Streaming incomplete inputautoClose on every parseNot supported
Official renderersVue, React, Svelte, Angular, Nuxt, HTML, ANSIReact, HTML
Schema validation of tagsNo, components validate their own propsYes, tag and attribute schemas
Variables and functions in contentBindings via :prop="expr" and {{ path }}Built-in $variables and functions
PartialsHandled in application codeBuilt-in {% partial %}
Plugin ecosystemComark plugins and markdown-it pluginsCustom nodes and tags configuration
Syntax lineageMarkdown directives proposal, 5 years of MDC in Nuxt ContentStripe'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:

{% callout type="note" %}
Useful information with **Markdown** inside.
{% /callout %}

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 step closes unfinished Markdown and open ::component blocks on every parse, so streamed LLM output renders frame by frame:

import { autoCloseMarkdown } from 'comark'

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

AST shape

Comark represents element nodes as compact tuples:

['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.

Framework coverage

Markdoc officially renders to React and HTML. Comark ships official renderers for Vue, React, Svelte, Angular, and Nuxt, plus HTML and 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.
  • 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 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

© 2026 Vercel, Inc.