Guide

Static fallbacks

Render Arrow fences without booting QuickJS for HTML, PDF, email, and ANSI targets. Choose source, placeholder, or caption fallbacks and pre-bundle TypeScript in Vite.

Non-executing render targets must not boot the VM. Use the HTML export and fallback options when output is a string, ANSI text, PDF, or email — not an interactive page.

Use the HTML renderer export

Import ArrowSandbox from comark-arrow/html for static pipelines:

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

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

The Vue component at comark-arrow/vue mounts the sandbox only in onMounted. SSR and Nuxt therefore skip VM boot during server render.

Choose a fallback mode

Control what non-interactive targets show via fence attribute or plugin option:

ValueOutput
captionDefault — short label or summary
sourceRaw fence source as text
placeholderEmpty or minimal block
fallback.ts
arrow({ fallback: 'source' })
fence-attr.md
```arrow {fallback="placeholder"}
// widget source — not executed in PDF/email pipeline
```

Pre-bundle TypeScript in Vite hosts

@arrow-js/sandbox does import ts from 'typescript'. Vite must pre-bundle TypeScript so the default export resolves correctly:

nuxt.config.ts
export default defineNuxtConfig({
  vite: {
    optimizeDeps: {
      include: ['typescript', '@arrow-js/sandbox', 'quickjs-emscripten'],
    },
  },
})

The same optimizeDeps.include array belongs in plain vite.config.ts for non-Nuxt Vite apps. Without it, dev-server lazy loading of the sandbox can fail when TypeScript is not pre-optimized.

Copyright © 2026