
comark
Comark (Components in Markdown) parser: syntax, AST, Vue/React/Svelte/Angular renderers, plugins, and LLM streaming with auto-close.
- Installs
- 214
- Last 24h
- +10
- Trending rank
- #8556
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/onmax/nuxt-skills --skill comark- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads comark automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
Comark - Skills Guide
A high-performance markdown parser with Comark (Components in Markdown) support, built on markdown-it, offering both string-based and streaming APIs.
Overview
Comark extends standard markdown with a powerful component system while maintaining full compatibility with CommonMark and GitHub Flavored Markdown. It provides:
- 🚀 High-performance parsing with markdown-it engine
- 📦 Streaming support with buffered and incremental modes
- ⚡ Real-time rendering with auto-close for incomplete syntax
- 🔧 Comark component syntax for custom components
- 🎨 Vue, React, Svelte & Angular renderers with custom component mapping
- 📝 YAML frontmatter support
- 📑 Automatic TOC generation
- 🎯 Full TypeScript support
- 🌈 Syntax highlighting with Shiki integration
Package Information
- Package Name:
comark - Installation:
npm install comarkorpnpm add comark - Exports:
- Main parser:
comark - Vue components:
@comark/vue - React components:
@comark/react - Svelte components:
@comark/svelte - Angular components:
@comark/angular - HTML rendering:
@comark/html - ANSI terminal rendering:
@comark/ansi - Nuxt module:
@comark/nuxt
- Main parser:
Quick Start
Basic Usage
import { parseMarkdown } from 'comark'
const content = `---
title: Hello World
---
# Hello World
This is **markdown** with :icon component.
::alert{type="info"}
Important message
::
`
const result = await parseMarkdown(content)
console.log(result.nodes) // Markdown AST
console.log(result.frontmatter) // { title: 'Hello World' }
console.log(result.meta) // Additional metadata
Vue Rendering
<template>
<Markdown :value="content" />
</template>
<script setup lang="ts">
import { Markdown } from '@comark/vue'
const content = `# Hello World`
</script>
React Rendering
import { Markdown } from '@comark/react'
export default function App() {
return <Markdown value={content} />
}
Svelte Rendering
<script lang="ts">
import { Markdown } from '@comark/svelte'
const content = `# Hello World`
</script>
<Markdown value={content} />
Angular Rendering
import { Component } from '@angular/core'
import { Markdown } from '@comark/angular'
@Component({
selector: 'app-root',
standalone: true,
imports: [Markdown],
template: `<comark-markdown [value]="content" />`,
})
export class AppComponent {
content = `# Hello World`
}
Documentation Sections
This guide is organized into focused sections covering different aspects of the package:
📝 1. Markdown Syntax
Learn how to write Comark documents with complete syntax reference:
- Standard Markdown: headings, text formatting, lists, links, images, blockquotes
- Frontmatter: YAML metadata with special fields (title, depth, searchDepth)
- Comark Components: block components (
::component), inline components (:component), properties, slots, nesting - Attributes: custom attributes on native markdown elements using
{...}syntax - Code Blocks: language specification, filename metadata, line highlighting, special characters
- Task Lists: GFM-style checkboxes with
[x]and[ ]syntax - Tables: GFM tables with alignment and inline markdown support
→ Read Full Markdown Syntax Guide
🔧 2. Parsing & Document Model
Complete guide for parsing and working with MarkdownDocument:
- String Parsing:
parseMarkdown()function with options (autoUnwrap, autoClose) - Async Parsing:
parseMarkdown()with Shiki syntax highlighting - Document Structure: serializable
MarkdownDocumentwith compact array-based nodes - Rendering Documents: convert to HTML (
renderHtmlFromDocumentvia@comark/html) or markdown (renderMarkdownviacomark/render) - Auto-close: automatic closing of unclosed syntax
- Auto-unwrap: remove unnecessary paragraph wrappers from container components
→ Read Full Parsing & Document Model Guide
⚛️ 3. Vue Rendering
Comprehensive guide for rendering in Vue applications:
- Basic Usage:
Markdowncomponent setup - Custom Components: mapping custom Vue components to Comark elements
- Dynamic Loading:
componentsManifestfor lazy-loaded components - Slots Support: named slots with
#slot-namesyntax - Streaming Mode: real-time rendering with reactive content
- Prose Components: pre-built styled components for standard elements
- Error Handling: built-in error capture for streaming scenarios
- Props Access: accessing
__nodeand parsed properties
→ Read Full Vue Rendering Guide
⚛️ 4. React Rendering
Comprehensive guide for rendering in React applications:
- Basic Usage:
Markdowncomponent setup - Custom Components: mapping custom React components to Comark elements
- Dynamic Loading:
componentsManifestfor lazy-loaded components - Props Conversion: automatic HTML attribute conversion (
class→className, etc.) - Streaming Mode: real-time rendering with reactive content
- Prose Components: pre-built styled components for standard elements
- Custom Props: accessing parsed properties and
__node - CSS Class Name: custom wrapper classes and Tailwind CSS integration
→ Read Full React Rendering Guide
🎡 5. Svelte Rendering
Comprehensive guide for rendering in Svelte 5 applications:
- Basic Usage:
Markdowncomponent setup with$state - Custom Components: mapping custom Svelte components to Comark elements
- Dynamic Loading:
componentsManifestfor lazy-loaded components - Props Mapping: attribute-to-prop conversion (close to HTML semantics)
- Streaming Mode: real-time rendering with reactive
$state - Experimental Async:
MarkdownAsyncwith<svelte:boundary> - Prose Components:
Proseprefix for overriding native HTML elements
→ Read Full Svelte Rendering Guide
🅰️ 6. Angular Rendering
Comprehensive guide for rendering in Angular 17+ applications:
- Basic Usage:
Markdownstandalone component setup - Custom Components: mapping Angular components to Comark elements
- Component Resolution:
Prose{PascalTag},PascalTag,tagpriority order - Content Projection: named slots via
<ng-content select="[slot=name]"> - Streaming Mode: real-time rendering with caret indicator
- Data Binding:
:bindingresolution with ambientdatainput - Pre-configured Components:
defineMarkdownComponentanddefineMarkdownDocumentComponent - Plugins: Math (KaTeX), Mermaid, Binding with Angular component wrappers
→ Read Full Angular Rendering Guide
🤖 7. Using with AI Agents
Guide for integrating Comark in AI agent and LLM streaming workflows:
- Streaming from LLMs: rendering incremental AI output in real time
- Auto-Close: handling incomplete syntax from partial LLM tokens
- Caret Indicator: showing a live cursor during generation
- Framework Examples: Vue, React, Svelte, Angular streaming patterns
- ANSI for CLIs: rendering AI output in terminal agents
→ Read Full Agents Guide
Key Features Deep Dive
Comark Component Syntax
Comark extends markdown with custom components while preserving readability:
<!-- Block Component -->
::alert{type="warning" .important}
This is a **warning** message with markdown support.
::
<!-- Inline Component -->
Check out this :icon-star{.text-yellow} component.
<!-- Component with Slots -->
::card
#header
## Title
#content
Main content
#footer
Footer
::
Markdown Document Model
Lightweight array-based structure for efficient processing:
interface MarkdownDocument {
nodes: [
["h1", { "id": "hello" }, "Hello"],
["p", {}, "Text with ", ["strong", {}, "bold"], " word"],
["alert", { "type": "info" }, "Message"]
],
frontmatter: {},
meta: {}
}
Common Use Cases
1. Static Site Generator
import { parseMarkdown } from 'comark'
import { renderHtmlFromDocument } from '@comark/html'
import shiki from '@comark/html/plugins/shiki'
async function processMarkdownFile(filePath: string) {
const content = await readFile(filePath, 'utf-8')
const doc = await parseMarkdown(content, {
plugins: [
shiki({
themes: { light: 'github-dark', dark: 'github-dark' },
}),
],
})
return {
html: await renderHtmlFromDocument(doc),
frontmatter: doc.frontmatter,
toc: doc.meta.toc
}
}
2. Real-time Markdown Editor
import { useState } from 'react'
import { Markdown } from '@comark/react'
export default function Editor() {
const [content, setContent] = useState('# Hello')
return (
<div className="split-editor">
<textarea value={content} onChange={e => setContent(e.target.value)} />
<Markdown value={content} />
</div>
)
}
3. Batch File Processing
import { readFile } from 'node:fs/promises'
import { parseMarkdown } from 'comark'
async function processMultipleFiles(files: string[]) {
const results = await Promise.all(
files.map(async (file) => {
const content = await readFile(file, 'utf-8')
return await parseMarkdown(content)
})
)
results.forEach((result, i) => {
console.log(`File ${files[i]}:`)
console.log(` - ${result.nodes.length} nodes`)
})
}
4. Documentation Platform
<template>
<article class="prose">
<Markdown :value="markdownContent" :components="docComponents" />
</article>
</template>
<script setup lang="ts">
import { Markdown } from '@comark/vue'
import { docComponents } from './components'
</script>
API Reference Summary
Core Functions (comark)
// Asynchronous parsing
parseMarkdown(source: string, options?: ParserOptions): Promise<MarkdownDocument>
// Auto-close unclosed syntax
autoCloseMarkdown(source: string): string
HTML Rendering Functions (@comark/html)
// Render markdown to HTML string (parse + render in one step)
renderHtml(markdown: string, options?: ParserOptions & RendererOptions): Promise<string>
// Render a pre-parsed document to HTML
renderHtmlFromDocument(document: MarkdownDocument, options?: RendererOptions): Promise<string>
// Create a reusable render function with shared parser instance
createHtmlRenderer(options?: ParserOptions & RendererOptions): (markdown: string) => Promise<string>
Vue Components (@comark/vue)
<Markdown :value="markdownString" :components="customComponents" />
React Components (@comark/react)
<Markdown value={markdownString} components={customComponents} />
Svelte Components (@comark/svelte)
<Markdown value={markdownString} components={customComponents} />
Angular Components (@comark/angular)
<comark-markdown [value]="markdownString" [components]="customComponents" />
Performance Characteristics
- Serializable document model - compact array-based nodes
- Lazy component loading - only load what's needed
- Shiki highlighter caching - avoid re-initialization
- Parallel processing - batch parse multiple files efficiently
TypeScript Support
Full TypeScript definitions included:
import type {
MarkdownDocument,
Node,
ParserOptions,
} from 'comark'
Architecture Overview
┌─────────────────────────────────────────┐
│ Markdown Input (String) │
└────────────────┬────────────────────────┘
│
┌────────▼────────┐
│ Auto-close │ (Optional)
│ Unclosed │
│ Syntax │
└────────┬────────┘
│
┌────────▼────────┐
│ Parse │
│ Frontmatter │ (YAML)
└────────┬────────┘
│
┌────────▼────────┐
│ MarkdownIt │
│ + Plugins │ (Comark, Tasks)
└────────┬────────┘
│
┌────────▼────────┐
│ Token │
│ Processing │
└────────┬────────┘
│
┌────────▼────────┐
│ Comark │
│ AST │
└────────┬────────┘
│
┌────────▼────────┐
│ Auto-unwrap │ (Optional)
└────────┬────────┘
│
┌────────▼────────┐
│ Generate TOC │
└────────┬────────┘
│
┌────────▼────────┐
│ MarkdownDocument │
│ (nodes + data │
│ + meta) │
└────────┬────────┘
│
┌───────────┬──────┴──────┬───────────┐
▼ ▼ ▼ ▼
┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐
│ Vue │ │ React │ │ Svelte │ │ Angular │
│ Renderer│ │ Renderer│ │ Renderer│ │ Renderer│
└─────────┘ └─────────┘ └─────────┘ └─────────┘
Contributing & Testing
See the test specifications for examples of all supported syntax features.
Run tests:
pnpm test
Run specific test:
pnpm test -- tests/parse.test.ts
Resources
- README: README.md - Installation and quick start
- Specifications: SPEC/ - Complete syntax test cases
Summary
Comark is a comprehensive solution for parsing and rendering markdown with component support. It excels at:
- Extending Markdown - Component syntax without breaking compatibility
- Streaming Support - Real-time rendering with auto-close
- Serializable Documents - Efficient
MarkdownDocumentmodel with compact nodes - Framework Support - First-class Vue, React, Svelte, and Angular integration
- Developer Experience - Full TypeScript support and comprehensive documentation
Choose Comark when you need:
- Markdown with custom components
- Streaming/incremental parsing
- Real-time markdown editors
- AI-generated content rendering
- Documentation platforms
- Static site generation with custom components
Next Steps:
- 📝 Learn Markdown Syntax
- 🔧 Master Parsing & AST
- ⚛️ Explore Vue Rendering
- ⚛️ Explore React Rendering
- 🎡 Explore Svelte Rendering
- 🅰️ Explore Angular Rendering
- 🤖 Use with AI Agents
FAQ
What does the comark skill do?
Comark (Components in Markdown) parser: syntax, AST, Vue/React/Svelte/Angular renderers, plugins, and LLM streaming with auto-close.
How do I install comark?
Run npx skills add https://github.com/onmax/nuxt-skills --skill comark in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/comark/ (personal) or .claude/skills/comark/ (project).
Which AI agents can use comark?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is comark safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains comark?
It is published by onmax in onmax/nuxt-skills. It has 214 recorded installs.
More from onmax/nuxt-skills
nuxt
onmax/nuxt-skills
Nuxt full-stack Vue framework with SSR, auto-imports, and file-based routing. Use when working with Nuxt apps, server routes, useFetch, middleware, or hybrid rendering.
vue
onmax/nuxt-skills
Vue 3 Composition API, script setup macros, reactivity system, and built-in components. Use when writing Vue SFCs, defineProps/defineEmits/defineModel, watchers, or using Transition/Teleport/Suspense/KeepAlive.
reka-ui
onmax/nuxt-skills
Use when building with Reka UI (headless Vue components) - provides component API, accessibility patterns, composition (asChild), controlled/uncontrolled state, virtualization, and styling integration. Formerly Radix Vue.
nuxt-ui
onmax/nuxt-skills
Build UIs with @nuxt/ui v4 — 125+ accessible Vue components with Tailwind CSS theming. Use when creating interfaces, customizing themes to match a brand, building forms, or composing layouts like dashboards, docs sites, and chat interfaces.
vitest
onmax/nuxt-skills
Vitest fast unit testing framework powered by Vite with Jest-compatible API. Use when writing tests, mocking, configuring coverage, or working with test filtering and fixtures.
nuxt-seo
onmax/nuxt-skills
Nuxt SEO meta-module with robots, sitemap, og-image, schema-org. Use when configuring SEO, generating sitemaps, creating OG images, or adding structured data.
Popular frontend & design skills
setup-matt-pocock-skills
mattpocock/skills
Configure this repo for the engineering skills: set up its issue tracker, triage label vocabulary, and domain doc layout. Run once before first use of the other engineering skills.
frontend-design
anthropics/skills
Guidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.
hyperframes-animation
heygen-com/hyperframes
All animation knowledge for HyperFrames — atomic motion rules, multi-phase scene blueprints, scene transitions, broader motion-design techniques, AND the seven runtime adapters (GSAP default, plus Lottie, Three.js, Anime.js, CSS keyframes, Web Animations API, TypeGPU). Use for any motion or animation task: pick 2-4 rules and compose, or load a blueprint, or look up runtime-specific API (e.g. GSAP eases / Lottie player / Three.js mixer). Also covers auditing an existing composition's choreography (animation map) and 24 named text-animation effects. HyperFrames-native: single paused timeline, seek-safe, deterministic.
prototype
mattpocock/skills
Build a throwaway prototype to answer a design question. Use when the user wants to sanity-check whether a state model or logic feels right, or explore what a UI should look like.
hyperframes-core
heygen-com/hyperframes
The HyperFrames composition contract — build one renderable project. Use for composition structure, the data- timing attributes, class="clip", tracks, sub-compositions, variables, framework-owned media playback, deterministic-render rules, and validation. Read before writing composition HTML.
vercel-react-best-practices
vercel-labs/agent-skills
React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.