Usage
Parse with the plugin
Use the core export when you only need AST nodes — no Vue, no sandbox boot:
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:
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:
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:
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.
Installation
Install comark-arrow with pnpm, npm, or yarn, plus @arrow-js/sandbox and optional Vue peers for interactive sandbox rendering in Comark.
Syntax
Author ArrowJS widgets with ```arrow fenced blocks, optional ```arrow-css styles, or ::arrow bound directives — both forms emit the same AST node.