Logo: Comark

Comark

Communautéit
onmax
comark

Comark (Components in Markdown) parser: syntax, AST, Vue/React/Svelte/Angular renderers, plugins, and LLM streaming with auto-close.

Add to TypingMind

Iwwersiicht

Editeuronmax
Repositorynuxt-skills
Skill-Nummcomark
Stären
711
Forks
37
Matgeliwwert Dateien
7
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • 7 matgeliwwert Dateien

    Skripten, Virlagen a Referenzen, déi de Modell beim Schaffe liese kann. D'Dateie kënnen nëmme gelies ginn a ginn ni ausgeféiert.

  • Open Source

    onmax huet de Skill op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Comark an TypingMind, fir e mat all LLM ze benotzen, oder setzt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vu GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier, déi hei drënner steet, an a bestätegt d'Installatioun.
    https://github.com/onmax/nuxt-skills/tree/main/skills/comark
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill derbäisetzen → Iwwer eng GitHub-URL. Pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an d'Skill-Verzeechnes vun deem KI-Agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/onmax/nuxt-skills.git /tmp/nuxt-skills
mkdir -p .claude/skills
cp -r /tmp/nuxt-skills/skills/comark .claude/skills/comark
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Comark an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet Comark automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Comark net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Schlësselen.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

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 comark or pnpm 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

Quick Start

Basic Usage

typescript
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

vue
<template>
  <Markdown :value="content" />
</template>

<script setup lang="ts">
import { Markdown } from '@comark/vue'

const content = `# Hello World`
</script>

React Rendering

tsx
import { Markdown } from '@comark/react'

export default function App() {
  return <Markdown value={content} />
}

Svelte Rendering

svelte
<script lang="ts">
  import { Markdown } from '@comark/svelte'

  const content = `# Hello World`
</script>

<Markdown value={content} />

Angular Rendering

typescript
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 MarkdownDocument with compact array-based nodes
  • Rendering Documents: convert to HTML (renderHtmlFromDocument via @comark/html) or markdown (renderMarkdown via comark/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: Markdown component setup
  • Custom Components: mapping custom Vue components to Comark elements
  • Dynamic Loading: componentsManifest for lazy-loaded components
  • Slots Support: named slots with #slot-name syntax
  • 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 __node and parsed properties

→ Read Full Vue Rendering Guide


⚛️ 4. React Rendering

Comprehensive guide for rendering in React applications:

  • Basic Usage: Markdown component setup
  • Custom Components: mapping custom React components to Comark elements
  • Dynamic Loading: componentsManifest for 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: Markdown component setup with $state
  • Custom Components: mapping custom Svelte components to Comark elements
  • Dynamic Loading: componentsManifest for lazy-loaded components
  • Props Mapping: attribute-to-prop conversion (close to HTML semantics)
  • Streaming Mode: real-time rendering with reactive $state
  • Experimental Async: MarkdownAsync with <svelte:boundary>
  • Prose Components: Prose prefix for overriding native HTML elements

→ Read Full Svelte Rendering Guide


🅰️ 6. Angular Rendering

Comprehensive guide for rendering in Angular 17+ applications:

  • Basic Usage: Markdown standalone component setup
  • Custom Components: mapping Angular components to Comark elements
  • Component Resolution: Prose{PascalTag}, PascalTag, tag priority order
  • Content Projection: named slots via <ng-content select="[slot=name]">
  • Streaming Mode: real-time rendering with caret indicator
  • Data Binding: :binding resolution with ambient data input
  • Pre-configured Components: defineMarkdownComponent and defineMarkdownDocumentComponent
  • 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:

markdown
<!-- 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:

typescript
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

typescript
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

tsx
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

typescript
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

vue
<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)

typescript
// Asynchronous parsing
parseMarkdown(source: string, options?: ParserOptions): Promise<MarkdownDocument>

// Auto-close unclosed syntax
autoCloseMarkdown(source: string): string

HTML Rendering Functions (@comark/html)

typescript
// 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)

vue
<Markdown :value="markdownString" :components="customComponents" />

React Components (@comark/react)

tsx
<Markdown value={markdownString} components={customComponents} />

Svelte Components (@comark/svelte)

svelte
<Markdown value={markdownString} components={customComponents} />

Angular Components (@comark/angular)

html
<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:

typescript
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:

bash
pnpm test

Run specific test:

bash
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:

  1. Extending Markdown - Component syntax without breaking compatibility
  2. Streaming Support - Real-time rendering with auto-close
  3. Serializable Documents - Efficient MarkdownDocument model with compact nodes
  4. Framework Support - First-class Vue, React, Svelte, and Angular integration
  5. 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:

Matgeliwwert Dateien

De Modell liest dës Dateie bei Bedarf, wärend de Skill gelueden ass. Si ginn als liesbar Dateie bereetgestallt a ginn ni ausgeféiert.

Heefeg gestallte Froen

Wat mécht de KI-Skill Comark?

Comark (Components in Markdown) parser: syntax, AST, Vue/React/Svelte/Angular renderers, plugins, and LLM streaming with auto-close.

Firwat Comark op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Comark besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt, amplaz en Abonnement pro Benotzerplaz ze bezuelen. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Comark an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/onmax/nuxt-skills/tree/main/skills/comark an. TypingMind liest d'Datei SKILL.md, bëndelt déi zougehéiereg Dateien an installéiert dat Ganzt als Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Comark benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat Comark benotzen?

Esou vill wéi Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Comark domat benotzen – zum Beispill mat GPT, Claude, Gemini, Grok, DeepSeek, Mistral oder Llama – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Comark gratis?

onmax huet de Skill op GitHub publizéiert. Kuckt am Repository no de Lizenzbedéngungen. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbare Pak vun Instruktiounen, deen engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt e maache soll a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a kee Lafzäitëmfeld a funktionéiere mat all Modell.

Alleguer weisen

Elo Ären eegene KI-Aarbechtsberäich ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇