Getting started

Usage

Add comark-arrow for parse-only AST nodes or use the Vue renderer with ArrowSandbox for live QuickJS widgets in Comark markdown.

Parse with the plugin

Use the core export when you only need AST nodes — no Vue, no sandbox boot:

index.ts
import { parseMarkdown } from 'comark'
import arrow from 'comark-arrow'

const tree = await parseMarkdown(content, {
  plugins: [arrow()],
})

Each ```arrow fence or ::arrow directive becomes ['ArrowSandbox', attrs] in the tree.

Render interactively in Vue

Import from comark-arrow/vue and register ArrowSandbox as a Comark component:

Markdown.vue
import arrow, { ArrowSandbox, provideArrowHostBridge } from 'comark-arrow/vue'

// <Markdown :plugins="[arrow()]" :components="{ ArrowSandbox }" />

provideArrowHostBridge() is optional. Use it when sandboxed code must call allowlisted host functions — see Host bridge.

Pair with streaming

When the document streams in, pass a getter so the last open fence stays non-executable:

streaming.ts
arrow({ streaming: () => isStreaming.value })

Pair with <Markdown :streaming="isStreaming">. Incomplete frames get status: 'pending'; <ArrowSandbox> shows a placeholder and never boots the VM. See Streaming.

Static HTML targets

For HTML string output (no VM), import from comark-arrow/html:

html-renderer.ts
import arrow from 'comark-arrow'
import { ArrowSandbox } from 'comark-arrow/html'

// createHtmlRenderer({ plugins: [arrow()], components: { ArrowSandbox } })

See Static fallbacks for fallback options and SSR notes.

Copyright © 2026