` for component prop maps, and prefer `interface` for object shapes.
+- **Formatting and linting**: Configured in `.oxlintrc.json` and `.oxfmtrc.json` (no semicolons, single quotes, 120 columns, ES5 trailing commas). There is no ESLint or Prettier config.
+- **Comments**: Only write comments that state invariants, constraints, security/DoS bounds, or spec subtleties the code cannot express on its own. Avoid ASCII section banners, narrated line-by-line comments, and em dashes in prose or comments.
-describe('functionUnderTest', () => {
- it('should handle basic case', () => {
- const input = 'test input'
- const expected = 'expected output'
- expect(functionUnderTest(input)).toBe(expected)
- })
-})
-```
-
-### What to Test
-
-1. **Happy path** - Normal expected usage
-2. **Edge cases** - Empty input, special characters, boundary conditions
-3. **Error tolerance** - Invalid/malformed input should not crash
-4. **Roundtrip** - Parse then render should preserve semantics
-
-## Key APIs
+## Document model and core invariants
-### parseMarkdown(source, options)
-
-```typescript
-const result = await parseMarkdown(markdownContent, {
- autoUnwrap: true, // Remove wrappers from single-paragraph containers
- autoClose: true, // Auto-close incomplete syntax; also accepts (markdown) => string
- unwrap: 'p', // Strip top-level wrapper tags (MDC unwrap); merges paragraphs
- registerDefaultPlugins: true, // linkify, frontmatter, html, alert, task-list, components, attributes; false to disable
- // linkify: false // deprecated (warns): use registerDefaultPlugins: false + linkify()
-})
-
-result.nodes // Node[]
-result.frontmatter // Record
-result.meta // Record
-```
-
-### autoCloseMarkdown(markdown, options?)
-
-Self-healing markdown for streaming. Heals incomplete CommonMark/GFM per
-`packages/comark/SPEC/auto-close.md`, then completes Comark components / tables / frontmatter.
-
-```typescript
-autoCloseMarkdown('**bold text') // '**bold text**'
-autoCloseMarkdown('::alert\nContent') // '::alert\nContent\n::'
-
-// Incomplete links get a safe placeholder URL (default protocol mode)
-autoCloseMarkdown('[partial')
-// '[partial](comark:incomplete-link)'
-
-// Math (inline `$` and block `$$`) is off by default on bare autoCloseMarkdown
-autoCloseMarkdown('$x = 5') // '$x = 5'
-autoCloseMarkdown('$x = 5', { math: true }) // '$x = 5$'
-// parseMarkdown / createMarkdownParser pass math: true when math plugin provided
-
-// Plain markdown without Comark component fences
-autoCloseMarkdown('**bold', { syntax: false })
-
-// Streaming: drop a half-typed opener after whitespace so it does not flash
-autoCloseMarkdown('hello *', { dropTrailingOpeners: true }) // 'hello'
-```
-
-Key options: `linkMode: 'protocol' | 'text-only'`, `math` (default false; on in parse),
-`dropTrailingOpeners` (default false; on when parsing with `streaming: true`),
-`incompleteLinkPlaceholder`, `incompleteImagePlaceholder`, `frontmatter`, `syntax`, `attributes`.
-Behavioral SPEC: `packages/comark/SPEC/auto-close.md` (run via `test/auto-close-spec.test.ts`).
-
-## Markdown Document Model
-
-Defined in `packages/comark/src/types.ts`. The live-update types (`ComarkDocument`,
-`ComarkPatch`, `ComarkContext`) live in `packages/comark/src/context.ts`.
+### Document model (`packages/comark/src/types.ts`)
```typescript
type TextNode = string
@@ -726,377 +238,101 @@ type ElementNodeAttributes = { [key: string]: unknown; $?: { line?: number; html
type ElementNode = [string, ElementNodeAttributes, ...Node[]]
type CommentNode = [null, ElementNodeAttributes, string]
type Node = ElementNode | TextNode | CommentNode
-type MarkdownDocument = {
+interface MarkdownDocument {
nodes: Node[]
frontmatter: Record
meta: Record
}
```
-Example:
-```typescript
-// Input: "# Hello **World**"
-// Output:
-{
- nodes: [
- ['h1', { id: 'hello-world' }, 'Hello ', ['strong', {}, 'World']]
- ],
- frontmatter: {},
- meta: {}
-}
-```
-
-## Indentation Inside Components
-
-A block component's children may be indented (aligned under the `::` marker) or
-not — both are valid input. Two rules keep the two forms interchangeable and
-lossless through `parseMarkdown` → `renderMarkdown`:
-
-**Parse — dedent the children, don't raise the floor.** A child indented *less*
-than its own component marker is never dropped. Each child line is shifted left
-by `min(markerIndent, its own indentation)` and the region is tokenized against
-a zero floor (`comark_block` in `src/plugins/components.ts` via
-`src/internal/parse/indent.ts`, mirroring the line-mark mutation `blockquote`
-uses to strip its markers). Lines inside a
-fenced code block all take the *opening fence's* shift, so the fence and its
-body move together. The shift is all or nothing: a tab that would have to be
-split into columns puts the region back and keeps the marker floor. A component
-with no outdented child is untouched.
-
-**Stringify — re-indent a block, never a line.** Nested components indent their
-rendered output by 2 spaces per level (`indent()` in `src/utils/index.ts`). The
-prefix is added to every line of the block, including the body of a fenced code
-block, so the fence and its content always move together.
-
-Uniform shifting is what makes fenced code survive. Indentation inside a fence
-is significant whitespace, and the parser cannot tell padding apart from code:
-
-```md
-::tabs
- :::tabs-item{label="Code"}
-```mdc
- ::accordion
- ::
-```
- :::
-::
-```
-
-The fence sits at indent 0 under a marker at indent 2, so fence and body shift
-by 0 and the body keeps the two spaces it has relative to its fence
-(`" ::accordion\n ::"`). Rendering back aligns the fence with its parent and
-carries the body along, which is a fixed point on re-parse:
-
-```md
-::tabs
- :::tabs-item{label="Code"}
- ```mdc
- ::accordion
- ::
- ```
- :::
-::
-```
-
-SPEC coverage: `SPEC/COMARK/component-nested-*-outdented.md`,
-`SPEC/COMARK/component-nested-codeblock-indented.md`,
-`SPEC/COMARK/codeblock-indented-content.md`.
+### `autoCloseMarkdown(markdown, options?)`
-## Embedded HTML
+Heals incomplete CommonMark and GFM per `packages/comark/SPEC/auto-close.md` (`test/auto-close-spec.test.ts`), plus Comark components, tables, and frontmatter.
-Contract: `packages/comark/SPEC/HTML/README.md`. HTML nodes carry
-`$: { html: 1, block: 0 | 1 }`. `block` means the tag outlived the paragraph
-that opened it, not that the tag is a block element. `html({ markdown: false })`
-keeps closed-block text literal; a blank line still nests real markdown under
-the open tag. `
```
-Note: Named slots from Comark (`#header`, `#content`, `#footer`) are rendered as `template` elements in the AST. The Svelte renderer passes all children (including named slot templates) as a single `children` snippet. To handle named slots individually, access the `__node` prop and filter children by template name.
-
---
-## Props Mapping
+## Props mapping
The Svelte renderer maps AST attributes to component props:
-### Attribute Mapping
+### Attribute mapping
```
-// Markdown attribute → Svelte prop
-{class="foo"} → class="foo" (pass-through)
-{className="foo"} → class="foo" (mapped)
-{style="color: red"} → style="color: red" (pass-through as string)
-{tabindex="0"} → tabindex="0" (pass-through)
-{:bool="true"} → bool={true} (parsed from string)
-{:count="5"} → count={5} (parsed as number)
-{:data='{"key":"val"}'} → data={{key:"val"}} (parsed as object)
+// Markdown attribute -> Svelte prop
+{class="foo"} -> class="foo" (pass-through)
+{className="foo"} -> class="foo" (mapped)
+{style="color: red"} -> style="color: red" (pass-through as string)
+{tabindex="0"} -> tabindex="0" (pass-through)
+{:bool="true"} -> bool={true} (parsed from string)
+{:count="5"} -> count={5} (parsed as number)
+{:data='{"key":"val"}'} -> data={{key:"val"}} (parsed as object)
```
-Svelte is closer to HTML than React, so most attributes pass through unchanged. The only mapping is `className` → `class`. Colon-prefixed attributes (`:prop="value"`) are parsed as typed values (boolean, number, JSON).
+Svelte is closer to HTML than React, so most attributes pass through unchanged. The only mapping is `className` to `class`. Colon-prefixed attributes (`:prop="value"`) are parsed as typed values (boolean, number, JSON).
-### Boolean Props
+### Boolean props
```
// Markdown: ::component{:disabled="true"}
@@ -272,7 +265,7 @@ Svelte is closer to HTML than React, so most attributes pass through unchanged.
// Svelte prop: visible={false}
```
-### Number Props
+### Number props
```
// Markdown: ::component{:count="5"}
@@ -282,7 +275,7 @@ Svelte is closer to HTML than React, so most attributes pass through unchanged.
// Svelte prop: max={100}
```
-### Object/Array Props
+### Object/array props
```
// Markdown: ::component{:config='{"theme":"dark"}'}
@@ -294,9 +287,9 @@ Svelte is closer to HTML than React, so most attributes pass through unchanged.
---
-## Streaming Mode
+## Streaming mode
-Use the `Markdown` component with `$state` for streaming content:
+Use `Markdown` with `$state` for streaming content:
```svelte
```
-### Custom Component Example
+### Custom component example
```vue
@@ -95,7 +82,7 @@ const id = computed(() => props.__node[1]?.id)
```
-### Alert Component Example
+### Alert component example
```vue
@@ -151,7 +138,7 @@ const iconName = computed(() => {
---
-## Dynamic Component Resolution
+## Dynamic component resolution
Load components dynamically using `componentsManifest`:
@@ -182,11 +169,11 @@ async function loadComponent(name: string) {
---
-## Slots Support
+## Slots support
-Comark components with slots work seamlessly in Vue:
+Comark named slots map directly to Vue slots:
-### Markdown with Slots
+### Markdown with slots
```markdown
::card
@@ -194,14 +181,14 @@ Comark components with slots work seamlessly in Vue:
## Card Title
#content
-Main content here with **markdown** support
+Main content here with **Markdown** support
#footer
Footer text
::
```
-### Custom Component with Slots
+### Custom component with slots
```vue
@@ -246,7 +233,7 @@ Footer text
```
-### Nested Slots
+### Nested slots
```markdown
::tabs
@@ -289,9 +276,9 @@ const activeTab = ref('tab1')
---
-## Streaming Mode
+## Streaming mode
-The `Markdown` component can be used with reactive content for streaming scenarios:
+Use `Markdown` with reactive content for streaming responses:
```vue
@@ -328,11 +315,9 @@ loadContent()
---
----
-
-## Prose Components
+## Prose components
-The `Markdown` component uses built-in prose styling automatically. You can override with custom components:
+`Markdown` renders standard HTML elements natively. Override them or register custom elements with `components`:
```vue
@@ -351,9 +336,9 @@ const components = {
---
-## Error Handling
+## Error handling
-The `MarkdownDocument` component has built-in error capture via Vue's `onErrorCaptured` hook. Component rendering errors are caught automatically without crashing the application. You can also use Vue's native `onErrorCaptured` in a parent component to handle errors:
+`MarkdownDocument` captures component rendering errors via Vue's `onErrorCaptured` hook without crashing the application. You can also use `onErrorCaptured` in a parent component to inspect or log errors:
```vue
@@ -373,7 +358,7 @@ onErrorCaptured((error) => {
---
-## Props Access
+## Props access
Custom components receive the original Comark node and parsed props:
@@ -390,7 +375,7 @@ import { computed } from 'vue'
const props = defineProps<{
type?: string // From {type="info"}
- bool?: boolean // From {bool} → :bool="true"
+ bool?: boolean // From {bool} -> :bool="true"
count?: number // From {:count="5"}
data?: object // From {:data='{"key":"val"}'}
__node?: any // Original Comark node
@@ -404,13 +389,13 @@ const alertClasses = computed(() => [
```
-### Property Parsing Rules
+### Property parsing rules
-- Props starting with `:` are parsed as booleans/JSON
-- Standard HTML attributes work normally
-- `__node` provides access to the raw AST node
+- Props starting with `:` are parsed as booleans or JSON
+- Standard HTML attributes pass through as strings
+- `__node` gives access to the raw AST node
-### Accessing Node Structure
+### Accessing node structure
```vue
```
-### Working with Complex Props
+### Working with complex props
```vue
@@ -459,4 +444,4 @@ Table content here
---
-[← Back to Main Skills Guide](../SKILL.md)
+[Back to skill guide](../SKILL.md)
diff --git a/docs/skills/migrate-mdc-to-comark/SKILL.md b/docs/skills/migrate-mdc-to-comark/SKILL.md
index 647265189..0f38876e6 100644
--- a/docs/skills/migrate-mdc-to-comark/SKILL.md
+++ b/docs/skills/migrate-mdc-to-comark/SKILL.md
@@ -6,32 +6,32 @@ description: >-
# Migrate from @nuxtjs/mdc to Comark
-`@nuxtjs/mdc` was Nuxt-only. Comark is its successor: the markdown syntax is fully compatible, your `.md` files need no changes. What changes is the JavaScript API.
+`@nuxtjs/mdc` was Nuxt-only. Comark is its successor. The Markdown syntax is compatible, so your `.md` files need no changes. What changes is the JavaScript API.
-The migration has two parts: **Core Package** (programmatic API) and **Nuxt Module** (components, slots, config).
+The migration has two parts: the **core package** (programmatic API) and the **Nuxt module** (components, slots, and config).
-## Quick Overview
+## Quick overview
-- **Package**: `@nuxtjs/mdc` → `comark` (core only) or `@comark/vue` (Vue renderer and Nuxt module)
-- **Parse**: `parseMarkdown()` → `parseMarkdown()` · factory: `createMarkdownParser()` (sync, no await)
-- **Render**: `stringifyMarkdown()` → `renderMarkdown()` from `comark/render`
-- **AST**: object tree → compact tuples `['tag', props, ...children]`
-- **Result**: `result.body` / `result.data` → `document.nodes` / `document.frontmatter`
-- **Renderer**: `` → ``
-- **All-in-one**: `` → ``
-- **Slots**: `` → native ``
-- **Plugins**: global `nuxt.config` → per-component `defineMarkdownComponent({ plugins })`
+- **Package**: `@nuxtjs/mdc` -> `comark` (core only) or `@comark/vue` (Vue renderer and Nuxt module)
+- **Parse**: `parseMarkdown()` -> `parseMarkdown()`, or `createMarkdownParser()` (synchronous, no `await`)
+- **Render**: `stringifyMarkdown()` -> `renderMarkdown()` from `comark/render`
+- **AST**: object tree -> compact tuples `['tag', props, ...children]`
+- **Result**: `result.body` / `result.data` -> `document.nodes` / `document.frontmatter`
+- **Renderer**: `` -> ``
+- **All-in-one**: `` -> ``
+- **Slots**: `` -> native ``
+- **Plugins**: global `nuxt.config` -> per-component `defineMarkdownComponent({ plugins })`
- **Binding**: `{{ path }}` via opt-in `binding()` plugin + render-time `data` prop (namespaced paths: `data.`, `frontmatter.`, `meta.`, `props.`)
- **Markdown files**: component syntax unchanged; update binding paths if you used bare MDC names
-## Core Package
+## Core package
-### API Mapping
+### API mapping
| `@nuxtjs/mdc` | `comark` |
|---|---|
| `parseMarkdown(md, opts)` | `parseMarkdown(md, opts)` from `comark` |
-| `createMarkdownParser(opts)` (async) | `createMarkdownParser(opts)` (sync, no await) |
+| `createMarkdownParser(opts)` (async) | `createMarkdownParser(opts)` (sync, no `await`) |
| `stringifyMarkdown(body, data)` | `renderMarkdown(document)` from `comark/render` |
| `result.body` (`MDCRoot`) | `document.nodes` (`Node[]`) |
| `result.data` | `document.frontmatter` |
@@ -39,7 +39,7 @@ The migration has two parts: **Core Package** (programmatic API) and **Nuxt Modu
| `result.toc` | `document.meta.toc` (requires `toc` plugin) |
| `result.excerpt` | `document.meta.summary` (requires `summary` plugin) |
-### AST Format
+### AST format
| `@nuxtjs/mdc` | `comark` |
|---|---|
@@ -47,7 +47,7 @@ The migration has two parts: **Core Package** (programmatic API) and **Nuxt Modu
| `{ type: 'element', tag: 'p', props: {}, children: [] }` | `['p', {}, ...children]` |
| `{ type: 'text', value: 'hello' }` | `'hello'` (plain string) |
-### Parse Options
+### Parse options
```typescript
// Before: MDCOptions
@@ -74,13 +74,13 @@ The `unified`/`remark`/`rehype` pipeline is replaced by Comark's own lighter plu
| Feature | Before | After |
|---|---|---|
| Syntax highlighting | `rehypeHighlight` via `createMarkdownParser` | `shiki()` from `comark/plugins/shiki` |
-| Table of Contents | `parseMarkdown(md, { toc: { depth: 3 } })` | `toc({ depth: 3 })` plugin |
-| Excerpt / Summary | `result.excerpt` (built-in) | `summary()` plugin → `document.meta.summary` |
+| Table of contents | `parseMarkdown(md, { toc: { depth: 3 } })` | `toc({ depth: 3 })` plugin |
+| Excerpt / summary | `result.excerpt` (built-in) | `summary()` plugin (`document.meta.summary`) |
| Emoji | `remark-emoji` (enabled by default) | `emoji()` plugin (opt-in) |
-Available plugins include: `toc`, `shiki`, `emoji`, `task-list`, `summary`, `security`, `alert`, `math`, `mermaid`, `punctuation`, `binding`. Prefer framework paths in apps (`@comark/vue/plugins/*`); use `comark/plugins/*` only for bare `parseMarkdown()`.
+Available plugins include `toc`, `shiki`, `emoji`, `task-list`, `summary`, `security`, `alert`, `math`, `mermaid`, `punctuation`, and `binding`. Prefer framework paths in apps (`@comark/vue/plugins/*`), and use `comark/plugins/*` only with bare `parseMarkdown()`.
-## Nuxt Module
+## Nuxt module
### Configuration
@@ -98,7 +98,7 @@ export default defineNuxtConfig({
})
```
-`@comark/vue` auto-imports: `Markdown`, `MarkdownDocument`, `defineMarkdownComponent`, `defineMarkdownDocumentComponent`.
+`@comark/vue` auto-imports `Markdown`, `MarkdownDocument`, `defineMarkdownComponent`, and `defineMarkdownDocumentComponent`.
### Components
@@ -117,15 +117,15 @@ For a pre-parsed document, use `` directly instead of `` | Comark `` | Notes |
|---|---|---|
| `body` (`MDCRoot`) | `value` (`MarkdownDocument`) | Different AST shape |
-| `data` | — | Frontmatter is in `value.frontmatter` |
-| `tag` | — | Wrapper is always `` |
-| `prose` | — | `Prose*` resolution is automatic |
+| `data` | None | Frontmatter is in `value.frontmatter` |
+| `tag` | None | Wrapper is always `
` |
+| `prose` | None | `Prose*` resolution is automatic |
| `unwrap` | `unwrap` prop / parse option | `
` or parse `unwrap` |
-| — | `data` | Runtime values for data binding / `{{ }}` — not frontmatter |
+| None | `data` | Runtime values for data binding and `{{ }}`, not frontmatter |
| `components` | `components` | Same purpose |
-| — | `componentsManifest` | New: dynamic async component resolver |
-| — | `streaming` | New: streaming mode |
-| — | `caret` | New: animated caret for streaming |
+| None | `componentsManifest` | New: dynamic async component resolver |
+| None | `streaming` | New: streaming mode |
+| None | `caret` | New: animated caret for streaming |
#### Summary rendering
@@ -157,13 +157,13 @@ export const ArticleMarkdown = defineMarkdownComponent({
### Slots
-`
` → native `
`. Named slots work the same (`#slotName` in markdown, `
` in component). The `unwrap` attribute (``) strips wrapper tags from children.
+Replace `` with native ``. Named slots work the same (`#slotName` in Markdown, `` in the component). The `unwrap` attribute (``) strips wrapper tags from children.
-### Prose Components
+### Prose components
-Same `Prose*.vue` naming convention. Resolution changed from kebab-case (`prose-p`) to PascalCase (`ProseP`) internally. The Comark Nuxt module does not register `components/prose/` globally: pass the components through `components` / `defineMarkdownComponent()`, or add `components: [{ path: '~/components/prose', global: true, pathPrefix: false }, '~/components']` to `nuxt.config.ts`.
+`Prose*.vue` uses the same naming convention, resolved internally as PascalCase (`ProseP`) rather than kebab-case (`prose-p`). The Comark Nuxt module does not register `components/prose/` globally. Pass the components through `components` or `defineMarkdownComponent()`, or add `components: [{ path: '~/components/prose', global: true, pathPrefix: false }, '~/components']` to `nuxt.config.ts`.
-### Nuxt UI Integration
+### Nuxt UI integration
When using Nuxt UI, the `@comark/vue` Nuxt module registers Nuxt UI prose components automatically. Shorthand callout components are available:
@@ -176,16 +176,16 @@ When using Nuxt UI, the `@comark/vue` Nuxt module registers Nuxt UI prose compon
These are **only available with Nuxt UI**. Without it, use `::callout{icon="..." color="..."}`.
-## Common Pitfalls
+## Common pitfalls
-1. **`createMarkdownParser` is sync**: no `await` needed (unlike `createMarkdownParser`)
-2. **Attribute naming**: Comark uses `attrs.lang`, not `attrs.language`
-3. **Frontmatter**: stored in `document.frontmatter`, not passed separately
-4. **`renderMarkdown` includes frontmatter**: reads `document.frontmatter` automatically
-5. **No `unified` pipeline**: `mdc.config.ts` hooks (`pre`, `remark`, `rehype`, `post`) have no equivalent, use `ComarkPlugin` interface instead
-6. **Emoji is opt-in**: not enabled by default like in MDC's `remark-emoji`
+1. **`createMarkdownParser` is sync**: no `await` needed (unlike `@nuxtjs/mdc`'s `createMarkdownParser`).
+2. **Code block language attribute**: Comark sets `attrs.language` on `` nodes and `class="language-*"` on `` nodes.
+3. **Frontmatter**: stored in `document.frontmatter`, not passed separately.
+4. **`renderMarkdown` includes frontmatter**: reads `document.frontmatter` automatically.
+5. **No `unified` pipeline**: `mdc.config.ts` hooks (`pre`, `remark`, `rehype`, `post`) have no direct equivalent; write a `ComarkPlugin` instead.
+6. **Emoji is opt-in**: not enabled by default like MDC's `remark-emoji`.
-## Component Syntax
+## Component syntax
The MDC block and inline component syntax is identical, so no changes are needed in `.md` files for components, slots, and attributes.
diff --git a/examples/1.frameworks/astro/README.md b/examples/1.frameworks/astro/README.md
index 2a637d560..bbbaba5fd 100644
--- a/examples/1.frameworks/astro/README.md
+++ b/examples/1.frameworks/astro/README.md
@@ -1,25 +1,22 @@
----
-title: Astro
-description: A blog example using Comark with Astro content collections and React components.
-navigation:
- icon: i-simple-icons:astro
-category: Frameworks
-path: /examples/frameworks/astro
----
-
-::code-explorer
----
-org: comarkdown
-repo: comark@81a416b278b0f304d7e7577c7ac6bbfc78414790
-path: examples/1.frameworks/astro
-defaultValue: src/content/posts/comark-syntax.md
----
-::
-
-This example demonstrates how to use Comark with Astro content collections and React components. Blog posts are stored as `.md` files with Zod-validated frontmatter, loaded via the `glob()` loader, and rendered using `MarkdownDocument` from `comark/react` with custom components like `Alert`.
+# Astro blog with Comark
+
+This example renders Markdown blog posts with Astro content collections, Zod frontmatter schemas, and React components via `@comark/react`.
## How it works
-- **Content collections** — Posts are defined with `glob()` loader and a Zod schema for type-safe frontmatter (title, description, pubDate, tags).
-- **Comark parsing** — In the blog post page, `parseMarkdown()` converts the raw Markdown body into a Comark AST.
-- **React rendering** — `MarkdownDocument` from `comark/react` renders the AST using React components, including custom ones like `Alert`. Thanks to Astro's React integration, these are server-rendered with zero client-side JavaScript.
+- **Content collections**: `src/content.config.ts` loads `.md` files from `src/content/posts/` with Astro's `glob()` loader and validates frontmatter (`title`, `description`, `pubDate`, and `tags`) with Zod.
+- **Comark parsing**: `src/pages/posts/[...id].astro` passes `post.body` to `parseMarkdown()` with `shiki()` to build a `MarkdownDocument`.
+- **Server rendering**: `MarkdownDocument` from `@comark/react` renders the document and custom components such as `Alert` to static HTML at build time, with zero client-side JavaScript.
+
+## Run locally
+
+From the monorepo root:
+
+```bash
+pnpm dev:astro
+```
+
+## Documentation
+
+- [Comark documentation](https://comark.dev)
+- [React rendering](https://comark.dev/rendering/react)
diff --git a/examples/1.frameworks/astro/src/content/posts/astro-integration.md b/examples/1.frameworks/astro/src/content/posts/astro-integration.md
index c00af4c49..8cc50b972 100644
--- a/examples/1.frameworks/astro/src/content/posts/astro-integration.md
+++ b/examples/1.frameworks/astro/src/content/posts/astro-integration.md
@@ -1,48 +1,54 @@
---
title: Integrating Comark with Astro
-description: How the Comark + Astro integration works under the hood.
+description: How this blog pairs Astro content collections with Comark and React components.
pubDate: 2026-01-10
tags: [comark, astro, integration]
---
-This example uses Astro's content collections with Comark as the Markdown renderer.
+This example pairs Astro content collections with `parseMarkdown()` and `@comark/react`.
## How it works
-Instead of using Astro's built-in remark/rehype pipeline, we use Comark's framework-agnostic API:
+Instead of Astro's default remark and rehype pipeline, each post route parses raw Markdown directly with Comark:
-1. **Define collections** — Use `glob()` loader to load `.md` files with Zod-validated frontmatter
-2. **Get the body** — Access the raw Markdown via `entry.body`
-3. **Parse with Comark** — Call `parseMarkdown()` to build the AST
-4. **Render to HTML** — Call `renderHtmlFromDocument()` with custom component renderers
+1. **Define collections**: load `.md` files with Astro's `glob()` loader and validate frontmatter with Zod.
+2. **Read the raw body**: access the unparsed Markdown string on `post.body`.
+3. **Parse with Comark**: call `parseMarkdown()` with `shiki()` to produce a `MarkdownDocument`.
+4. **Render on the server**: pass the document to `MarkdownDocument` from `@comark/react` along with custom components.
-```ts
+```astro
+---
+import { getCollection } from 'astro:content'
import { parseMarkdown } from 'comark'
-import { renderHtmlFromDocument } from '@comark/html'
-
-const doc = await parseMarkdown(entry.body)
-const html = await renderHtmlFromDocument(doc, {
- components: {
- alert: async ([tag, attrs, ...children], { render }) => {
- return `${await render(children)}
`
- },
- },
+import { MarkdownDocument } from '@comark/react'
+import shiki from 'comark/plugins/shiki'
+import Alert from '../../components/Alert'
+
+const document = await parseMarkdown(post.body!, {
+ plugins: [shiki()],
})
+---
+
+
```
::alert{type="info"}
-Since Astro components run on the server, Comark's `parseMarkdown()` and `renderHtmlFromDocument()` are called at build time — zero JavaScript is sent to the client.
+Astro runs `parseMarkdown()` and renders `MarkdownDocument` at build time, so no JavaScript is sent to the browser for post content.
::
## Custom components
-You can register any number of custom components. Each one receives the Comark AST element and a `render` helper to process children:
-
-```ts
-const badge: ComponentRenderFn = async ([tag, attrs, ...children], { render }) => {
- const color = attrs.color || 'blue'
- return `${await render(children)}`
+Map custom React components through the `components` prop on `MarkdownDocument`. Each component receives resolved attributes as props and nested Markdown as `children`:
+
+```tsx
+export default function Alert({ type = 'info', children }: {
+ type?: 'info' | 'warning' | 'success' | 'danger'
+ children?: React.ReactNode
+}) {
+ return (
+
+ {children}
+
+ )
}
```
-
-This makes it easy to extend your Markdown with reusable, styled components.
diff --git a/examples/1.frameworks/astro/src/content/posts/comark-syntax.md b/examples/1.frameworks/astro/src/content/posts/comark-syntax.md
index 6a85f3f18..2b4f73b33 100644
--- a/examples/1.frameworks/astro/src/content/posts/comark-syntax.md
+++ b/examples/1.frameworks/astro/src/content/posts/comark-syntax.md
@@ -1,38 +1,38 @@
---
-title: Comark Syntax Guide
-description: A quick tour of what you can do with Comark's component syntax.
+title: Comark syntax guide
+description: A tour of standard Markdown and Comark component syntax.
pubDate: 2025-12-15
tags: [comark, syntax, components]
---
-Comark is **Components in Markdown** — it extends standard Markdown with a powerful component syntax.
+Comark adds block and inline component syntax to CommonMark and GFM.
## Inline formatting
-You can use all the usual Markdown formatting: **bold**, *italic*, `code`, and [links](https://comark.dev).
+Standard Markdown formatting works everywhere: **bold**, *italic*, `code`, and [links](https://comark.dev).
## Components
-Components use the `::` syntax. They can have attributes and children:
+Block components open and close with `::` and accept props in `{...}`:
::alert{type="warning"}
-Pay attention to the double-colon syntax — it's how Comark identifies components.
+Double colons open a block component, and props inside curly braces pass directly to the rendered component.
::
## Lists
-Comark handles lists, of course:
+Unordered and ordered lists support nested inline formatting:
- First item
- Second item with **bold** text
- Third item with `inline code`
-1. Numbered items work too
-2. With full Markdown support inside
+1. Numbered items
+2. Nested Markdown inside each item
## Code blocks
-Syntax highlighting works out of the box:
+Fenced code blocks highlight through the `shiki` plugin:
```js
function greet(name) {
@@ -42,8 +42,8 @@ function greet(name) {
## Block quotes
-> Comark makes Markdown more powerful without sacrificing simplicity.
+> Standard block quotes, lists, and code blocks can sit outside or inside custom components.
::alert{type="danger"}
-Don't forget to close your components with `::` — otherwise `autoClose` will handle it for you!
+Close block components with `::`. During streaming, `autoClose` closes unfinished blocks until the closing marker arrives.
::
diff --git a/examples/1.frameworks/astro/src/content/posts/hello-world.md b/examples/1.frameworks/astro/src/content/posts/hello-world.md
index 84f0d7053..dadcd62d0 100644
--- a/examples/1.frameworks/astro/src/content/posts/hello-world.md
+++ b/examples/1.frameworks/astro/src/content/posts/hello-world.md
@@ -1,32 +1,32 @@
---
-title: Hello World
+title: Hello world
description: Getting started with Comark and Astro content collections.
pubDate: 2025-12-01
tags: [comark, astro]
---
-Welcome to this blog powered by **Comark** and Astro content collections!
+Welcome to this blog built with **Comark** and Astro content collections.
-Comark extends standard Markdown with component syntax, and it integrates seamlessly with Astro's server-first architecture.
+Comark adds component and attribute syntax to Markdown while rendering everything on the server during `astro build`.
::alert{type="info"}
-This alert is rendered using a custom Comark component — no client-side JavaScript required.
+This alert renders through a custom React component on the server, with no client-side bundle.
::
-## Why Comark + Astro?
+## Why pair Comark with Astro
-- **Server-rendered** — Comark parses and renders on the server via `parseMarkdown()` and `renderHtmlFromDocument()`
-- **Content collections** — Full frontmatter validation with Zod schemas
-- **Component syntax** — Embed custom components directly in your Markdown
+- **Server-rendered**: `parseMarkdown()` and `MarkdownDocument` run at build time and emit static HTML.
+- **Typed frontmatter**: Astro content collections validate post metadata with Zod schemas.
+- **Component syntax**: write `::alert{type="info"}` blocks directly in `.md` files and render them with React components.
```ts
import { parseMarkdown } from 'comark'
-import { renderHtmlFromDocument } from '@comark/html'
+import { MarkdownDocument } from '@comark/react'
-const doc = await parseMarkdown(markdown)
-const html = await renderHtmlFromDocument(doc, { components: { alert } })
+const document = await parseMarkdown(markdown)
+//
```
::alert{type="success"}
-You get the best of both worlds: Astro's content layer for structure and Comark for rendering.
+Astro manages collection loading and routing while Comark parses Markdown and renders custom components.
::
diff --git a/examples/1.frameworks/nextjs/README.md b/examples/1.frameworks/nextjs/README.md
index d83a676d1..254492f90 100644
--- a/examples/1.frameworks/nextjs/README.md
+++ b/examples/1.frameworks/nextjs/README.md
@@ -1,30 +1,23 @@
----
-title: Next.js
-description: A blog example using Comark with Next.js App Router and React Server Components.
-navigation:
- icon: i-simple-icons:nextdotjs
-category: Frameworks
-path: /examples/frameworks/nextjs
-demo: https://comark-nextjs.vercel.app
----
-
-::code-explorer
----
-org: comarkdown
-repo: comark@81a416b278b0f304d7e7577c7ac6bbfc78414790
-path: examples/1.frameworks/nextjs
-defaultValue: content/posts/comark-syntax.md
----
-::
-
-::browser{src="https://comark-nextjs.vercel.app/blog/comark-syntax"}
-::
-
-This example demonstrates how to use Comark with Next.js App Router and React Server Components. Blog posts are stored as `.md` files with frontmatter, parsed using `parseMarkdown()` from `comark`, and rendered using `MarkdownDocument` from `@comark/react` with custom components like `Alert`, `FeatureCard`, and a copyable `CodeBlock`.
+# Next.js blog with Comark and React Server Components
+
+This example renders a static Markdown blog with the Next.js App Router and React Server Components. Posts live as `.md` files in `content/posts/`, parse on the server with `parseMarkdown()` from `comark`, and render with `MarkdownDocument` from `@comark/react`.
## How it works
-- **File-based content** — Posts are plain `.md` files in `content/posts/` with YAML frontmatter for metadata (title, description, pubDate, tags).
-- **Comark parsing** — `lib/posts.ts` reads markdown files and uses `parseMarkdown()` to build the AST and extract frontmatter — replacing the usual `gray-matter` + `remark` + `rehype` pipeline.
-- **Static generation** — `generateStaticParams` pre-renders all blog posts at build time via `output: 'export'`.
-- **React rendering** — `MarkdownDocument` from `@comark/react` renders the AST using React Server Components, including custom ones like `Alert`, slot-aware components like `FeatureCard`, and `CodeBlock`. Content rendering stays on the server; only the copy button hydrates on the client.
+- **File-based content**: `.md` files in `content/posts/` store post bodies and YAML frontmatter (`title`, `description`, `pubDate`, and `tags`).
+- **Comark parsing**: `lib/posts.ts` reads each file and calls `parseMarkdown()` with `shiki()` to build the `MarkdownDocument` and extract frontmatter in one step, instead of chaining `gray-matter`, `remark`, and `rehype`.
+- **Static generation**: `generateStaticParams` pre-renders every blog post at build time with `output: 'export'`.
+- **Server Components**: `MarkdownDocument` renders custom components such as `Alert`, slot-aware `FeatureCard`, and `CodeBlock` on the server; only the copy button hydrates on the client.
+
+## Run locally
+
+From the monorepo root:
+
+```bash
+pnpm dev:nextjs
+```
+
+## Documentation
+
+- [Comark documentation](https://comark.dev)
+- [React rendering](https://comark.dev/rendering/react)
diff --git a/examples/1.frameworks/nextjs/content/posts/comark-syntax.md b/examples/1.frameworks/nextjs/content/posts/comark-syntax.md
index 0cdd0e22a..0464a9782 100644
--- a/examples/1.frameworks/nextjs/content/posts/comark-syntax.md
+++ b/examples/1.frameworks/nextjs/content/posts/comark-syntax.md
@@ -1,34 +1,34 @@
---
-title: Comark Syntax Guide
-description: A quick tour of what you can do with Comark's component syntax.
+title: Comark syntax guide
+description: A tour of standard Markdown, custom components, and named slots in Comark.
pubDate: 2025-12-15
tags: [comark, syntax, components]
---
-Comark is **Components in Markdown** — it extends standard Markdown with a powerful component syntax.
+Comark adds block and inline component syntax to CommonMark and GFM.
## Inline formatting
-You can use all the usual Markdown formatting: **bold**, *italic*, `code`, and [links](https://comark.dev).
+Standard Markdown formatting works everywhere: **bold**, *italic*, `code`, and [links](https://comark.dev).
## Components
-Components use the `::` syntax. They can have attributes and children:
+Block components open and close with `::` and accept props in `{...}`:
::alert{type="warning"}
-Pay attention to the double-colon syntax — it's how Comark identifies components.
+Double colons open a block component, and props inside curly braces pass directly to the rendered React component.
::
## Component slots
-React components receive default content as `children`, and named slots as props like `slotHeader` and `slotFooter`:
+React components receive default content as `children` and named `#slot` sections as `slot*` props such as `slotHeader` and `slotFooter`:
::feature-card
#header
Slot-aware React component
#default
-This body is the default slot. It can contain **Markdown**, links, lists, or any nested Comark content.
+This body renders in the default `children` slot. It can contain **Markdown**, links, lists, or nested Comark components.
#footer
Rendered through the `slotFooter` prop in `FeatureCard.tsx`.
@@ -36,18 +36,18 @@ Rendered through the `slotFooter` prop in `FeatureCard.tsx`.
## Lists
-Comark handles lists, of course:
+Unordered and ordered lists support nested inline formatting:
- First item
- Second item with **bold** text
- Third item with `inline code`
-1. Numbered items work too
-2. With full Markdown support inside
+1. Numbered items
+2. Nested Markdown inside each item
## Code blocks
-Syntax highlighting works out of the box:
+Fenced code blocks highlight through the `shiki` plugin:
```js
function greet(name) {
@@ -57,8 +57,8 @@ function greet(name) {
## Block quotes
-> Comark makes Markdown more powerful without sacrificing simplicity.
+> Standard block quotes, lists, and code blocks can sit outside or inside custom components.
::alert{type="danger"}
-Don't forget to close your components with `::` — otherwise `autoClose` will handle it for you!
+Close block components with `::`. During streaming, `autoClose` closes unfinished blocks until the closing marker arrives.
::
diff --git a/examples/1.frameworks/nextjs/content/posts/hello-world.md b/examples/1.frameworks/nextjs/content/posts/hello-world.md
index 90de1efab..f2aee3cf9 100644
--- a/examples/1.frameworks/nextjs/content/posts/hello-world.md
+++ b/examples/1.frameworks/nextjs/content/posts/hello-world.md
@@ -1,23 +1,23 @@
---
-title: Hello World
-description: Getting started with Comark and Next.js.
+title: Hello world
+description: Getting started with Comark and Next.js Server Components.
pubDate: 2025-12-01
tags: [comark, nextjs]
---
-Welcome to this blog powered by **Comark** and Next.js!
+Welcome to this blog built with **Comark** and the Next.js App Router.
-Comark extends standard Markdown with component syntax, and it integrates seamlessly with Next.js's server-first architecture.
+Comark adds component and attribute syntax to Markdown and renders through React Server Components at build time.
::alert{type="info"}
-This alert is rendered using a custom Comark component — no client-side JavaScript required.
+This alert renders on the server through a custom React component, without shipping parser code to the client.
::
-## Why Comark + Next.js?
+## Why pair Comark with Next.js
-- **Server-rendered** — Comark parses and renders on the server via `parseMarkdown()` and `MarkdownDocument`
-- **Static generation** — Full SSG with `generateStaticParams` for zero-latency delivery
-- **Component syntax** — Embed custom components directly in your Markdown
+- **Server-rendered**: `parseMarkdown()` and `MarkdownDocument` run inside Server Components.
+- **Static export**: `generateStaticParams` pre-renders every post to static HTML at build time.
+- **Component syntax**: write `::alert` and `::feature-card` blocks directly in `.md` files.
```ts
import { parseMarkdown } from 'comark'
@@ -28,5 +28,5 @@ const tree = await parseMarkdown(markdown)
```
::alert{type="success"}
-You get the best of both worlds: Next.js's static generation for performance and Comark for rich rendering.
+Next.js handles routing and static export while Comark parses frontmatter, highlights code, and renders React components.
::
diff --git a/examples/1.frameworks/nextjs/content/posts/nextjs-integration.md b/examples/1.frameworks/nextjs/content/posts/nextjs-integration.md
index 74797124c..b76c741bb 100644
--- a/examples/1.frameworks/nextjs/content/posts/nextjs-integration.md
+++ b/examples/1.frameworks/nextjs/content/posts/nextjs-integration.md
@@ -1,20 +1,20 @@
---
title: Integrating Comark with Next.js
-description: How the Comark + Next.js integration works under the hood.
+description: How this blog renders Markdown with Comark and React Server Components.
pubDate: 2026-01-10
tags: [comark, nextjs, integration]
---
-This example uses Next.js App Router with Comark as the Markdown renderer.
+This example pairs the Next.js App Router with `parseMarkdown()` and `@comark/react`.
## How it works
-Instead of using the typical `gray-matter` + `remark` + `rehype` pipeline, we use Comark's framework-agnostic API:
+Instead of chaining `gray-matter`, `remark`, and `rehype`, `lib/posts.ts` parses Markdown and frontmatter in a single call:
-1. **Read markdown files** — Load `.md` files from the `content/posts/` directory
-2. **Parse with Comark** — Call `parseMarkdown()` to build the AST and extract frontmatter
-3. **Static generation** — Use `generateStaticParams` for full SSG
-4. **Render with React** — Use `MarkdownDocument` from `@comark/react` with custom components
+1. **Read Markdown files**: load `.md` files from `content/posts/` with `node:fs`.
+2. **Parse with Comark**: call `parseMarkdown()` with `shiki()` to build the `MarkdownDocument` and read `tree.frontmatter`.
+3. **Generate static routes**: return all post slugs from `generateStaticParams`.
+4. **Render in a Server Component**: pass `tree` to `MarkdownDocument` from `@comark/react` with custom components.
```ts
import { parseMarkdown } from 'comark'
@@ -27,17 +27,17 @@ const tree = await parseMarkdown(content, {
plugins: [shiki()],
})
-// In your Server Component:
+// Inside a Server Component:
//
```
::alert{type="info"}
-Since Next.js Server Components run on the server, Comark's `parseMarkdown()` is called at build time — zero JavaScript is sent to the client.
+Because Next.js Server Components execute at build time during static export, `parseMarkdown()` and Shiki never ship to the browser.
::
## Custom components
-You can register any number of custom components. Each one receives props and children from the Comark AST. This example maps `CodeBlock` to `pre` to add a copy button while keeping source extraction on the server.
+Register custom components on the `components` prop of `MarkdownDocument`. Each component receives resolved attributes and rendered children. For example, mapping `CodeBlock` to `pre` adds a client copy button while keeping code highlighting on the server:
```tsx
export default function Alert({ type = 'info', children }) {
@@ -48,5 +48,3 @@ export default function Alert({ type = 'info', children }) {
)
}
```
-
-This makes it easy to extend your Markdown with reusable, styled components.
diff --git a/examples/1.frameworks/nuxt/README.md b/examples/1.frameworks/nuxt/README.md
index 3f2a72280..336b399af 100644
--- a/examples/1.frameworks/nuxt/README.md
+++ b/examples/1.frameworks/nuxt/README.md
@@ -1,28 +1,22 @@
----
-title: Nuxt
-description: A minimal example showing how to use Comark Syntax with Nuxt UI.
-category: Frameworks
-navigation:
- icon: i-simple-icons-nuxt
-path: /examples/frameworks/nuxt-ui
----
-
-::code-explorer
----
-org: comarkdown
-repo: comark@c78885ca7504b38afc7ced59aac1a3c6b3cc5425
-path: examples/1.frameworks/nuxt
-defaultValue: content/posts/comark-syntax.md
----
-::
-
-::Browser{src="https://comark-nuxt.vercel.app/blog/comark-syntax"}
-::
-
-This example demonstrates how to use Comark Syntax with Nuxt UI. Comark Syntax automatically detects when Nuxt UI is installed and uses its components for rendering. Simply add both `@comark/vue` and `@nuxt/ui` modules to your Nuxt config, and the `Markdown` component will use Nuxt UI components automatically.
-
-## What does the `@comark/vue` Nuxt module do
-
-- Auto-imports the `` and `` components.
-- Auto-imports the `defineMarkdownComponent()` and `defineMarkdownDocumentComponent()` helpers.
-- Detects Nuxt UI and tells Nuxt UI to register its Prose components.
+# Nuxt UI blog with Comark
+
+This example renders Markdown blog posts in Nuxt 4 with `@comark/vue` and Nuxt UI. Adding `@comark/vue` and `@nuxt/ui` to `modules` in `nuxt.config.ts` registers `` and `` and enables Nuxt UI prose components.
+
+## How it works
+
+- **Auto-imported components**: `@comark/vue/nuxt` registers `` and `` across the app.
+- **Auto-imported helpers**: `defineMarkdownComponent()`, `defineMarkdownDocumentComponent()`, `parseMarkdown()`, and `createMarkdownParser()` are available in app code and Nitro server routes.
+- **Nuxt UI prose**: the module detects `@nuxt/ui` and enables its `Prose*` components so headings, lists, links, and code blocks render with Nuxt UI styling.
+
+## Run locally
+
+From the monorepo root:
+
+```bash
+pnpm dev:nuxt
+```
+
+## Documentation
+
+- [Comark documentation](https://comark.dev)
+- [Vue and Nuxt rendering](https://comark.dev/rendering/vue#nuxt)
diff --git a/examples/1.frameworks/nuxt/content/posts/comark-syntax.md b/examples/1.frameworks/nuxt/content/posts/comark-syntax.md
index 6a85f3f18..9169aa526 100644
--- a/examples/1.frameworks/nuxt/content/posts/comark-syntax.md
+++ b/examples/1.frameworks/nuxt/content/posts/comark-syntax.md
@@ -1,38 +1,38 @@
---
-title: Comark Syntax Guide
-description: A quick tour of what you can do with Comark's component syntax.
+title: Comark syntax guide
+description: A tour of standard Markdown and Comark component syntax.
pubDate: 2025-12-15
tags: [comark, syntax, components]
---
-Comark is **Components in Markdown** — it extends standard Markdown with a powerful component syntax.
+Comark adds block and inline component syntax to CommonMark and GFM.
## Inline formatting
-You can use all the usual Markdown formatting: **bold**, *italic*, `code`, and [links](https://comark.dev).
+Standard Markdown formatting works everywhere: **bold**, *italic*, `code`, and [links](https://comark.dev).
## Components
-Components use the `::` syntax. They can have attributes and children:
+Block components open and close with `::` and accept props in `{...}`:
::alert{type="warning"}
-Pay attention to the double-colon syntax — it's how Comark identifies components.
+Double colons open a block component, and props inside curly braces pass directly to the rendered Vue component.
::
## Lists
-Comark handles lists, of course:
+Unordered and ordered lists support nested inline formatting:
- First item
- Second item with **bold** text
- Third item with `inline code`
-1. Numbered items work too
-2. With full Markdown support inside
+1. Numbered items
+2. Nested Markdown inside each item
## Code blocks
-Syntax highlighting works out of the box:
+Fenced code blocks highlight through the `shiki` plugin:
```js
function greet(name) {
@@ -42,8 +42,8 @@ function greet(name) {
## Block quotes
-> Comark makes Markdown more powerful without sacrificing simplicity.
+> Standard block quotes, lists, and code blocks can sit outside or inside custom components.
::alert{type="danger"}
-Don't forget to close your components with `::` — otherwise `autoClose` will handle it for you!
+Close block components with `::`. During streaming, `autoClose` closes unfinished blocks until the closing marker arrives.
::
diff --git a/examples/1.frameworks/nuxt/content/posts/hello-world.md b/examples/1.frameworks/nuxt/content/posts/hello-world.md
index a57fdf496..0657f77de 100644
--- a/examples/1.frameworks/nuxt/content/posts/hello-world.md
+++ b/examples/1.frameworks/nuxt/content/posts/hello-world.md
@@ -1,24 +1,24 @@
---
-title: Hello World
+title: Hello world
description: Getting started with Comark and Nuxt UI.
pubDate: 2025-12-01
tags: [comark, nuxt]
---
-Welcome to this blog powered by **Comark** and Nuxt UI!
+Welcome to this blog built with **Comark** and Nuxt UI.
-Comark extends standard Markdown with component syntax, and it integrates seamlessly with Nuxt's server-first architecture.
+Comark parses Markdown and custom `::` components in Nitro server routes and renders them on the server with `@comark/vue`.
::alert{type="info"}
-This alert is rendered using a custom Comark component — no client-side JavaScript required.
+This alert renders through `app/components/Alert.vue` on the server without extra component registration.
::
-## Why Comark + Nuxt UI?
+## Why pair Comark with Nuxt UI
-- **Server-rendered** — Comark parses and renders on the server via `parseMarkdown()` and `MarkdownDocument`
-- **Static generation** — Full SSG with `nuxt generate` for zero-latency delivery
-- **Component syntax** — Embed custom components directly in your Markdown
-- **Nuxt UI** — Beautiful prose components out of the box
+- **Server-rendered**: Nitro routes call `parseMarkdown()`, and `MarkdownDocument` renders the parsed tree during SSR.
+- **Static generation**: `nuxt generate` pre-renders every post route at build time.
+- **Component syntax**: write `::alert` blocks directly in `.md` files and resolve them against `app/components/`.
+- **Nuxt UI prose**: `@comark/vue` enables Nuxt UI's `Prose*` components for headings, paragraphs, code blocks, and lists.
```ts
import { parseMarkdown } from 'comark'
@@ -28,5 +28,5 @@ const tree = await parseMarkdown(markdown)
```
::alert{type="success"}
-You get the best of both worlds: Nuxt's static generation for performance and Comark for rich rendering.
+Nuxt handles routing, data fetching, and static generation while Comark parses Markdown and maps elements to Nuxt UI components.
::
diff --git a/examples/1.frameworks/nuxt/content/posts/nuxt-ui-integration.md b/examples/1.frameworks/nuxt/content/posts/nuxt-ui-integration.md
index 537c8224e..dabe5f365 100644
--- a/examples/1.frameworks/nuxt/content/posts/nuxt-ui-integration.md
+++ b/examples/1.frameworks/nuxt/content/posts/nuxt-ui-integration.md
@@ -1,20 +1,20 @@
---
title: Integrating Comark with Nuxt UI
-description: How the Comark + Nuxt UI integration works under the hood.
+description: How this Nuxt 4 app parses Markdown in Nitro routes and renders it with Nuxt UI prose components.
pubDate: 2026-01-10
tags: [comark, nuxt, integration]
---
-This example uses Nuxt 4 with Comark as the Markdown renderer and Nuxt UI for styled prose components.
+This example uses Nuxt 4 with Comark as the Markdown parser and renderer, and Nuxt UI for prose styling.
## How it works
-Instead of the typical `gray-matter` + `remark` + `rehype` pipeline, we use Comark's framework-agnostic API:
+Instead of chaining `gray-matter`, `remark`, and `rehype`, a Nitro server route parses Markdown and frontmatter in one step:
-1. **Read markdown files** — Load `.md` files from the `content/posts/` directory via a server route
-2. **Parse with Comark** — Call `parseMarkdown()` to build the AST and extract frontmatter
-3. **Static generation** — Use `nuxt generate` for full SSG
-4. **Render with Vue** — Use the auto-imported `MarkdownDocument` from `@comark/vue`
+1. **Read Markdown files**: load `.md` files from `content/posts/` inside a server route.
+2. **Parse with Comark**: call `parseMarkdown()` with `shiki()` to build the `MarkdownDocument` and read `tree.frontmatter`.
+3. **Generate static pages**: run `nuxt generate` to pre-render all post routes.
+4. **Render in Vue**: pass `post.tree` to the auto-imported `` component.
```ts
// server/api/posts/[slug].get.ts
@@ -41,24 +41,24 @@ const { data: post } = await useFetch(`/api/posts/${route.params.slug}`)
```
::alert{type="info"}
-The `@comark/vue` Nuxt module automatically detects Nuxt UI and enables its prose components — no extra configuration needed.
+The `@comark/vue` Nuxt module detects `@nuxt/ui` and turns on its prose component set without extra configuration.
::
## Nuxt UI prose components
-When both `@comark/vue` and `@nuxt/ui` are installed, the module sets `ui.prose = true`. This registers Nuxt UI's `Prose*` components globally:
+When both `@comark/vue` and `@nuxt/ui` are installed, the module sets `ui.prose = true`, registering Nuxt UI's `Prose*` components globally:
-- `ProseH1`, `ProseH2`, `ProseH3` for headings
+- `ProseH1`, `ProseH2`, and `ProseH3` for headings
- `ProseP` for paragraphs
-- `ProseCode`, `ProsePre` for code
-- `ProseUl`, `ProseOl`, `ProseLi` for lists
-- And more…
+- `ProseCode` and `ProsePre` for inline and fenced code
+- `ProseUl`, `ProseOl`, and `ProseLi` for lists
+- `ProseA`, `ProseBlockquote`, and `ProseTable` for links, quotes, and tables
-`MarkdownDocument` automatically picks these up — no manual wiring required.
+`MarkdownDocument` resolves standard Markdown tags to these global components automatically.
## Custom components
-You can still register custom components. Each one receives props and children from the Comark AST:
+Custom components in `app/components/` receive props and default slot content from the Comark document:
```vue
@@ -67,10 +67,10 @@ defineProps<{ type?: 'info' | 'warning' | 'success' | 'danger' }>()
-
+
```
-Since Nuxt auto-registers components in `app/components/`, `MarkdownDocument` resolves them automatically.
+Because Nuxt registers components in `app/components/`, `MarkdownDocument` resolves `::alert` to `Alert.vue`.
diff --git a/examples/1.frameworks/sveltekit/README.md b/examples/1.frameworks/sveltekit/README.md
index 91f96763d..ca65d9100 100644
--- a/examples/1.frameworks/sveltekit/README.md
+++ b/examples/1.frameworks/sveltekit/README.md
@@ -1,35 +1,23 @@
----
-title: SvelteKit
-description: A SvelteKit example showing Comark with lazy components, MarkdownAsync, and SSR.
-navigation:
- icon: i-simple-icons-svelte
-category: Frameworks
-path: /examples/frameworks/sveltekit
----
-
-::code-explorer
----
-org: comarkdown
-repo: comark@c78885ca7504b38afc7ced59aac1a3c6b3cc5425
-path: examples/1.frameworks/sveltekit
-defaultValue: 'src/routes/+page.svelte'
----
-::
-
-::Browser{src="https://comark-sveltekit.vercel.app"}
-::
-
-This example demonstrates how to use Comark with SvelteKit and server-side rendering.
+# SvelteKit Markdown with SSR and lazy components
+
+This example renders Markdown on the server in SvelteKit using `@comark/svelte` and `@comark/svelte/async`.
## How it works
-- **Lazy SSR route** — `/` renders markdown with `` and resolves custom components through an explicit dynamic import map.
-- **Stable SSR route** — `/stable` parses markdown in `+page.server.ts` and renders the AST with ``.
-- **Scoped Markdown components** — components rendered from Comark live in `src/lib/components/comark/`, separate from normal app UI components.
-- **Component manifest** — the examples show when to return dynamic imports and when to use eager/static entries for synchronous SSR.
+- **Lazy SSR route**: `/` renders Markdown with `` and resolves custom components through a dynamic import map.
+- **Stable SSR route**: `/stable` parses Markdown inside `+page.server.ts` and passes the serialized document to ``.
+- **Scoped Markdown components**: components exposed to Markdown live in `src/lib/components/comark/`, separate from application layout components.
+- **Component manifest**: compares dynamic imports for async SSR with static imports for synchronous SSR.
+
+## Run locally
-Run locally:
+From the monorepo root:
```bash
-pnpm --filter comark-sveltekit dev
+pnpm dev:sveltekit
```
+
+## Documentation
+
+- [Comark documentation](https://comark.dev)
+- [Svelte rendering](https://comark.dev/rendering/svelte)
diff --git a/examples/1.frameworks/vitepress/README.md b/examples/1.frameworks/vitepress/README.md
index 21441c294..a969eed0e 100644
--- a/examples/1.frameworks/vitepress/README.md
+++ b/examples/1.frameworks/vitepress/README.md
@@ -1,25 +1,23 @@
----
-title: VitePress
-description: Using Comark component syntax natively in VitePress via the components and attributes plugins.
-navigation:
- icon: i-simple-icons-vitepress
-category: Frameworks
-path: /examples/frameworks/vitepress
----
-
-::code-explorer
----
-org: comarkdown
-repo: comark@81a416b278b0f304d7e7577c7ac6bbfc78414790
-path: examples/1.frameworks/vitepress
-defaultValue: demo.md
----
-::
-
-This example shows how to use Comark's `::` component syntax natively in VitePress — no wrapper component or custom renderer needed.
+# Comark components in VitePress
+
+This example adds Comark's `::` component syntax and `{...}` inline attributes directly to VitePress through its markdown-it configuration, without a wrapper component or custom renderer.
## How it works
-- **`comark/plugins/components` + `comark/plugins/attributes`** — Added to VitePress's markdown-it config via `markdown.config(md)`, this enables the `::component{props}` syntax at the markdown-it level.
-- **Global component registration** — Vue components like `Alert` are registered globally in the VitePress theme via `enhanceApp`, so `::alert{type="info"}` resolves to the `` component.
-- **Native coexistence** — Comark syntax works alongside all VitePress Markdown features (code blocks, tables, custom containers, GitHub alerts, etc.) since both use markdown-it.
+- **markdown-it plugins**: `.vitepress/config.ts` registers `markdownItComponents` from `comark/plugins/components` and `markdownItAttributes` from `comark/plugins/attributes` inside `markdown.config(md)`.
+- **Global component registration**: Vue components such as `Alert` register globally in the VitePress theme through `enhanceApp`, so `::alert{type="info"}` renders ``.
+- **VitePress Markdown compatibility**: Comark blocks and attributes work alongside VitePress code blocks, tables, custom containers, and GitHub alerts because both run on markdown-it.
+
+## Run locally
+
+From the monorepo root:
+
+```bash
+pnpm dev:vitepress
+```
+
+## Documentation
+
+- [Comark documentation](https://comark.dev)
+- [Components plugin](https://comark.dev/plugins/defaults/components)
+- [Attributes plugin](https://comark.dev/plugins/defaults/attributes)
diff --git a/examples/1.frameworks/vitepress/demo.md b/examples/1.frameworks/vitepress/demo.md
index a3687935b..d8e764e3d 100644
--- a/examples/1.frameworks/vitepress/demo.md
+++ b/examples/1.frameworks/vitepress/demo.md
@@ -1,32 +1,32 @@
-# Comark Demo
+# Comark demo
-This page uses [Comark syntax](https://github.com/comarkdown/comark) directly in VitePress Markdown — no wrapper component needed.
+This page uses [Comark syntax](https://github.com/comarkdown/comark) directly in VitePress Markdown without a wrapper component.
-The `comark/plugins/components` and `comark/plugins/attributes` plugins are added to VitePress's markdown-it config, enabling the `::` component syntax natively.
+VitePress loads `markdownItComponents` from `comark/plugins/components` and `markdownItAttributes` from `comark/plugins/attributes` in `.vitepress/config.ts`, so `::` block components parse during the standard VitePress build.
## Alerts
::alert{type="info"}
-This is an **info** alert rendered using a Vue component registered in the VitePress theme.
+This **info** alert renders through a Vue component registered globally in the VitePress theme.
::
::alert{type="success"}
-Comark's component syntax works natively alongside VitePress's own Markdown features.
+Comark component blocks work alongside VitePress's built-in Markdown extensions.
::
::alert{type="warning"}
-Make sure to register your components globally in the VitePress theme.
+Register custom Vue components globally in `.vitepress/theme/index.ts` so VitePress can resolve them in Markdown pages.
::
::alert{type="danger"}
-This is a danger alert — useful for critical warnings.
+Use a `danger` alert to call out breaking changes or destructive operations.
::
## How it works
-1. Add `comark/plugins/components` and `comark/plugins/attributes` to VitePress's markdown-it config
-2. Register Vue components globally in the theme
-3. Write `::component{props}` syntax directly in your `.md` files
+1. Register `markdownItComponents` and `markdownItAttributes` in VitePress's `markdown.config(md)` hook.
+2. Register Vue components globally in the VitePress theme.
+3. Write `::component{props}` blocks directly in `.md` files.
```ts
// .vitepress/config.ts
@@ -45,12 +45,12 @@ export default defineConfig({
## Mixed content
-You can mix Comark components with standard VitePress Markdown features:
+Comark components work alongside VitePress Markdown features on the same page:
- **Bold**, *italic*, and `inline code`
-- [Links](https://github.com/comarkdown/comark) work as expected
-- Tables, code blocks, and all VitePress extensions are unaffected
+- [Links](https://github.com/comarkdown/comark)
+- Tables, fenced code blocks, custom containers, and GitHub alerts
::alert{type="info"}
-This alert sits right next to standard Markdown — everything coexists naturally.
+This alert sits next to standard VitePress lists and headings on the same page.
::
diff --git a/examples/1.frameworks/vitepress/index.md b/examples/1.frameworks/vitepress/index.md
index b0c948010..f0f437d1e 100644
--- a/examples/1.frameworks/vitepress/index.md
+++ b/examples/1.frameworks/vitepress/index.md
@@ -3,16 +3,16 @@ layout: home
hero:
name: Comark + VitePress
text: Components in Markdown
- tagline: Use Comark's component syntax inside VitePress documentation sites.
+ tagline: Add Comark component and attribute syntax to VitePress documentation sites.
actions:
- theme: brand
- text: View Demo
+ text: View demo
link: /demo
features:
- - title: Component Syntax
- details: Write ::alert{type="info"} directly in your content and render it with Vue components.
- - title: Vue Renderer
- details: Comark's Vue renderer (comark/vue) integrates seamlessly with VitePress.
- - title: Server & Client
- details: Works with VitePress SSG — parsed at build time, hydrated on the client.
+ - title: Component syntax
+ details: Write ::alert{type="info"} blocks directly in Markdown files and render them with Vue components.
+ - title: markdown-it integration
+ details: Plug markdownItComponents and markdownItAttributes directly into VitePress's markdown.config hook.
+ - title: Static build and hydration
+ details: VitePress parses Comark syntax at build time and hydrates interactive Vue components on the client.
---
diff --git a/examples/2.vite/angular/README.md b/examples/2.vite/angular/README.md
index a649ef77e..abcd8d474 100644
--- a/examples/2.vite/angular/README.md
+++ b/examples/2.vite/angular/README.md
@@ -1,19 +1,22 @@
----
-title: Angular
-description: A minimal example showing how to use Comark with Angular and Vite.
-navigation:
- icon: i-simple-icons-angular
-category: Vite
-path: /examples/vite/angular
----
-
-::code-explorer
----
-org: comarkdown
-repo: comark@81a416b278b0f304d7e7577c7ac6bbfc78414790
-path: examples/2.vite/angular
-defaultValue: src/main.ts
----
-::
-
-This example demonstrates the simplest way to use Comark with Angular - use the `Markdown` component and pass it markdown content. The component handles parsing and rendering automatically.
+# Angular Markdown example with Vite
+
+This example renders a Markdown blog, component syntax examples, and a live editor in Angular 21+ with Vite and `@comark/angular`.
+
+## How it works
+
+- **High-level rendering**: pass a Markdown string to `` to parse and render in one step.
+- **Pre-parsed rendering**: load `.md` files with `import.meta.glob`, parse them with `parseMarkdown()` and `shiki()`, and pass the document to ``.
+- **Custom standalone components**: map Angular standalone components such as `AlertComponent` through `[components]`.
+
+## Run locally
+
+From the monorepo root:
+
+```bash
+pnpm dev:angular
+```
+
+## Documentation
+
+- [Comark documentation](https://comark.dev)
+- [Angular rendering](https://comark.dev/rendering/angular)
diff --git a/examples/2.vite/angular/content/posts/angular-integration.md b/examples/2.vite/angular/content/posts/angular-integration.md
index 456d638ef..42b536690 100644
--- a/examples/2.vite/angular/content/posts/angular-integration.md
+++ b/examples/2.vite/angular/content/posts/angular-integration.md
@@ -1,20 +1,20 @@
---
-title: Integrating Comark with Angular + Vite
-description: How the Comark + Angular + Vite integration works under the hood.
+title: Integrating Comark with Angular and Vite
+description: How this client-side SPA pairs Angular standalone components and Vite with Comark.
pubDate: 2026-01-10
tags: [comark, angular, integration]
---
-This example uses Angular 17+ with Vite (via Analog) and Comark as the Markdown renderer.
+This example uses Angular 21+ with Vite (through Analog) and `@comark/angular` as the Markdown renderer.
## How it works
-Instead of the typical `gray-matter` + `remark` + `rehype` pipeline, we use Comark's framework-agnostic API:
+Instead of chaining `gray-matter`, `remark`, and `rehype`, `src/app/lib/posts.ts` parses Markdown and frontmatter in a single call:
-1. **Load markdown files** — Use Vite's `import.meta.glob` with `?raw` to eagerly load `.md` files
-2. **Parse with Comark** — Call `parseMarkdown()` to build the AST and extract frontmatter
-3. **Route with Angular Router** — Hash-based routing for a zero-config static SPA
-4. **Render with Angular** — Use `MarkdownDocument` from `@comark/angular` with explicit component mapping
+1. **Load Markdown files**: bundle `.md` files as raw strings at build time using Vite's `import.meta.glob` with `?raw`.
+2. **Parse with Comark**: call `parseMarkdown()` with `shiki()` to build the `MarkdownDocument` and read `document.frontmatter`.
+3. **Route with Angular Router**: configure hash-based routing (`withHashLocation()`) for static hosting.
+4. **Render with Angular**: pass `post.tree` and a `components` map to `` from `@comark/angular`.
```ts
// src/app/lib/posts.ts
@@ -45,16 +45,16 @@ export async function getPost(slug: string) {
}
`,
})
-export class BlogPostComponent { /* ... */ }
+export class BlogPostComponent { /* post loading omitted */ }
```
::alert{type="info"}
-Since this is a client-side SPA, `parseMarkdown()` runs in the browser. Markdown files are bundled as raw strings at build time via `import.meta.glob`.
+Because this app runs as a client-side SPA, `parseMarkdown()` executes in the browser against raw Markdown strings bundled by `import.meta.glob`.
::
## Custom components
-Pass custom components via the `components` input on ``. Each component receives props as `@Input()` values and children via ``:
+Pass custom Angular components to `[components]` on ``. Each component receives attributes through `@Input()` properties and nested children through ``:
```ts
@Component({
@@ -70,5 +70,3 @@ export class AlertComponent {
@Input() type: 'info' | 'warning' | 'error' | 'success' = 'info'
}
```
-
-This makes it easy to extend your Markdown with reusable, styled Angular components.
diff --git a/examples/2.vite/angular/content/posts/comark-syntax.md b/examples/2.vite/angular/content/posts/comark-syntax.md
index 26f220a53..5dba7de50 100644
--- a/examples/2.vite/angular/content/posts/comark-syntax.md
+++ b/examples/2.vite/angular/content/posts/comark-syntax.md
@@ -1,38 +1,38 @@
---
-title: Comark Syntax Guide
-description: A quick tour of what you can do with Comark's component syntax.
+title: Comark syntax guide
+description: A tour of standard Markdown and Comark component syntax.
pubDate: 2025-12-15
tags: [comark, syntax, components]
---
-Comark is **Components in Markdown** — it extends standard Markdown with a powerful component syntax.
+Comark adds block and inline component syntax to CommonMark and GFM.
## Inline formatting
-You can use all the usual Markdown formatting: **bold**, *italic*, `code`, and [links](https://comark.dev).
+Standard Markdown formatting works everywhere: **bold**, *italic*, `code`, and [links](https://comark.dev).
## Components
-Components use the `::` syntax. They can have attributes and children:
+Block components open and close with `::` and accept props in `{...}`:
::alert{type="warning"}
-Pay attention to the double-colon syntax — it's how Comark identifies components.
+Double colons open a block component, and props inside curly braces map directly to Angular component inputs.
::
## Lists
-Comark handles lists, of course:
+Unordered and ordered lists support nested inline formatting:
- First item
- Second item with **bold** text
- Third item with `inline code`
-1. Numbered items work too
-2. With full Markdown support inside
+1. Numbered items
+2. Nested Markdown inside each item
## Code blocks
-Syntax highlighting works out of the box:
+Fenced code blocks highlight through the `shiki` plugin:
```js
function greet(name) {
@@ -42,8 +42,8 @@ function greet(name) {
## Block quotes
-> Comark makes Markdown more powerful without sacrificing simplicity.
+> Standard block quotes, lists, and code blocks can sit outside or inside custom components.
::alert{type="error"}
-Don't forget to close your components with `::` — otherwise `autoClose` will handle it for you!
+Close block components with `::`. During streaming, `autoClose` closes unfinished blocks until the closing marker arrives.
::
diff --git a/examples/2.vite/angular/content/posts/hello-world.md b/examples/2.vite/angular/content/posts/hello-world.md
index 90132b39c..0449a62f7 100644
--- a/examples/2.vite/angular/content/posts/hello-world.md
+++ b/examples/2.vite/angular/content/posts/hello-world.md
@@ -1,24 +1,24 @@
---
-title: Hello World
-description: Getting started with Comark and Angular + Vite.
+title: Hello world
+description: Getting started with Comark, Angular, and Vite.
pubDate: 2025-12-01
tags: [comark, angular]
---
-Welcome to this blog powered by **Comark** and Angular + Vite!
+Welcome to this blog built with **Comark**, Angular, and Vite.
-Comark extends standard Markdown with component syntax, and it integrates seamlessly with Angular's standalone components.
+Comark adds component and attribute syntax to Markdown and renders nodes directly into Angular standalone components.
::alert{type="info"}
-This alert is rendered using a custom Comark component mapped via the `components` input.
+This alert renders through an Angular standalone component registered in the `[components]` input.
::
-## Why Comark + Angular?
+## Why pair Comark with Angular
-- **Standalone** — Uses Angular 17+ standalone components — no NgModules needed
-- **Component syntax** — Embed custom Angular components directly in your Markdown
-- **Content projection** — Children are projected via ``
-- **Fast** — Powered by Vite + Analog for instant HMR
+- **Standalone components**: uses Angular 21+ standalone components without NgModules.
+- **Component syntax**: write `::alert` blocks directly in `.md` files and map them to Angular components.
+- **Content projection**: nested Markdown children project into ``.
+- **Vite dev server**: uses `@analogjs/vite-plugin-angular` for Vite builds and hot module replacement.
```ts
import { parseMarkdown } from 'comark'
@@ -29,5 +29,5 @@ const document = await parseMarkdown(markdown)
```
::alert{type="success"}
-You get the best of both worlds: Angular's change detection for dynamic content and Comark for rich rendering.
+Angular manages routing and component inputs while Comark parses Markdown and instantiates mapped components.
::
diff --git a/examples/2.vite/angular/src/app/components/feature-card.component.ts b/examples/2.vite/angular/src/app/components/feature-card.component.ts
index f78b997be..ec0393540 100644
--- a/examples/2.vite/angular/src/app/components/feature-card.component.ts
+++ b/examples/2.vite/angular/src/app/components/feature-card.component.ts
@@ -4,9 +4,9 @@ import { Component } from '@angular/core'
* A card component demonstrating named slot support in Comark.
*
* Slots:
- * - `header` — rendered in the card header area
- * - `default` — rendered in the card body
- * - `footer` — rendered in the card footer area
+ * - `header`: rendered in the card header area
+ * - `default`: rendered in the card body
+ * - `footer`: rendered in the card footer area
*/
@Component({
selector: 'app-feature-card',
diff --git a/examples/2.vite/angular/src/app/pages/live.component.ts b/examples/2.vite/angular/src/app/pages/live.component.ts
index 0819d8206..419b82b73 100644
--- a/examples/2.vite/angular/src/app/pages/live.component.ts
+++ b/examples/2.vite/angular/src/app/pages/live.component.ts
@@ -3,8 +3,8 @@ import { MarkdownDocument } from '@comark/angular'
import { createComarkContext, parseMarkdown, type MarkdownDocument as Document } from 'comark'
// A driver installs a context on globalThis once; every
-// then auto-subscribes. The buttons act as the driver here — but it could just as
-// well be HMR, a collab socket, an agent, or devtools.
+// then auto-subscribes. The buttons act as the driver here, or it could be
+// HMR, a collab socket, an agent, or devtools.
const ctx = createComarkContext()
const INITIAL = `# Live document
diff --git a/examples/2.vite/angular/vite.config.ts b/examples/2.vite/angular/vite.config.ts
index 8b301079d..0020a438c 100644
--- a/examples/2.vite/angular/vite.config.ts
+++ b/examples/2.vite/angular/vite.config.ts
@@ -6,15 +6,15 @@ import type { Plugin } from 'vite'
/**
* In a pnpm workspace, Vite follows symlinks and resolves workspace-linked
- * packages to their real source paths (e.g. `/packages/comark/…`).
+ * packages to their real source paths (e.g. `/packages/comark/...`).
* This breaks Vite's dep optimizer for non-Angular packages like the core
- * `comark` parser — their transitive deps (linkify-it, mdurl, etc.) can't
+ * `comark` parser; their transitive deps (linkify-it, mdurl, etc.) can't
* be resolved from the real source path.
*
* This plugin maps the core `comark` package back to its `node_modules`
* symlink path so Vite's dep optimizer bundles it correctly.
*
- * NOTE: `@comark/angular` is intentionally NOT remapped — it contains
+ * NOTE: `@comark/angular` is intentionally NOT remapped because it contains
* Angular `@Component` decorators that Analog's fast-compile plugin
* must AOT-compile.
*/
@@ -60,7 +60,7 @@ export default defineConfig({
angular({
tsconfig: './tsconfig.json',
fastCompile: true,
- // define.ts uses @Component inside a factory function — a pattern the
+ // define.ts uses @Component inside a factory function, a pattern the
// fast-compile OXC scanner can't handle (it only finds top-level classes).
// Excluding it lets Angular's standard JIT/AOT pipeline compile it instead.
transformFilter: (_code, id) => !id.includes('/define.ts'),
diff --git a/examples/2.vite/ansi/src/main.ts b/examples/2.vite/ansi/src/main.ts
index bdf0e3e9d..645d45743 100644
--- a/examples/2.vite/ansi/src/main.ts
+++ b/examples/2.vite/ansi/src/main.ts
@@ -109,8 +109,6 @@ $$
_Edit the markdown on the left to see live updates._
`
-// --- Terminal setup ---
-
const term = new Terminal({
convertEol: true,
cursorBlink: false,
@@ -151,8 +149,6 @@ fitAddon.fit()
window.addEventListener('resize', () => fitAddon.fit())
-// --- Render logic ---
-
async function render(markdown: string) {
const tree = await parseMarkdown(markdown)
const ansi = await renderAnsiFromDocument(tree, {
@@ -164,8 +160,6 @@ async function render(markdown: string) {
term.write(ansi)
}
-// --- Editor setup ---
-
const input = document.getElementById('input') as HTMLTextAreaElement
input.value = SAMPLE
render(SAMPLE)
diff --git a/examples/2.vite/html/README.md b/examples/2.vite/html/README.md
index eb1443609..afa7ec284 100644
--- a/examples/2.vite/html/README.md
+++ b/examples/2.vite/html/README.md
@@ -1,183 +1,36 @@
----
-title: HTML Preview
-description: A live markdown editor that renders Comark content to HTML and displays it in a sandboxed iframe preview, with syntax highlighting support.
-navigation:
- icon: i-lucide-file-code
-category: Vite
-path: /examples/vite/html
----
+# Live Markdown to HTML preview
-::code-tree{defaultValue="src/main.ts" expandAll}
+This example builds a split-pane live Markdown editor in Vite using `@comark/html`, Shiki, KaTeX, and Mermaid. Typing Comark Markdown on the left renders HTML into a sandboxed `