@comark/nuxt
@comark/nuxt
Zero-config Nuxt module for Comark, a high-performance markdown parser and renderer.
Features
- ⚡ Auto-imported
<Markdown>and<MarkdownDocument>components - 📁
~/components/prosedirectory for overriding HTML elements - 🎨 Automatic Nuxt UI prose integration
- 🖥️ SSR, SSG, and prerendering support out of the box
- 🧩 Re-exports of Comark plugins (binding, math, mermaid)
- 🎯 Full TypeScript support
Installation
Automatic
Add @comark/nuxt to your project. This installs the dependency and registers the module in nuxt.config.ts:
npx nuxt add comark
Manual
Add @comark/nuxt to your dependencies:
npm install @comark/nuxt
# or
pnpm add @comark/nuxt
Then add it to your nuxt.config.ts:
export default defineNuxtConfig({
modules: ['@comark/nuxt'],
})
Usage
The <Markdown> component is available globally, no imports needed. Pass markdown via the default slot or the value prop:
<script setup lang="ts">
const content = `# Hello Nuxt\n\nRendered with **Comark**.`
</script>
<template>
<Markdown>{{ content }}</Markdown>
</template>
Custom components
Map Comark tags to your own Vue components:
<script setup lang="ts">
import Alert from '~/components/Alert.vue'
</script>
<template>
<Markdown :components="{ alert: Alert }">{{ content }}</Markdown>
</template>
::alert{type="warning"}
This is a warning.
::
Overriding HTML elements
Drop components into ~/components/prose to override how native HTML elements render. They are auto-registered:
~/components/prose/
ProseH1.vue
ProsePre.vue
ProseA.vue
Plugins
<script setup lang="ts">
import math, { Math } from '@comark/nuxt/plugins/math'
import mermaid, { Mermaid } from '@comark/nuxt/plugins/mermaid'
</script>
<template>
<Markdown
:components="{ math: Math, mermaid: Mermaid }"
:plugins="[math(), mermaid()]"
>
{{ content }}
</Markdown>
</template>
Nuxt UI
When @nuxt/ui is installed, prose components are wired up automatically:
export default defineNuxtConfig({
modules: ['@comark/nuxt', '@nuxt/ui'],
})
Documentation
Full guide and API reference at comark.dev/rendering/nuxt.
Agent skill
Coding agents can install the Comark skill from the docs site:
npx skills add https://comark.dev
License
Made with ❤️
Published under MIT License.
Related Packages
Vue 3 renderer for Comark. Render Markdown with components at runtime, with stre...
A Nuxt module designed for integrating Mermaid with `@nuxt/content`. It automati...
Vue 3 port of streamdown — a drop-in replacement for vue-markdown, designed for...
Version History
| Version | Released | Vue | License |
|---|---|---|---|
| 0.8.1 | ^3.0 | ||
| 0.8.0 | ^3.0 | ||
| 0.7.0 | ^3.0 | ||
| 0.6.2 | ^3.0 | ||
| 0.6.1 | ^3.0 | ||
| 0.6.0 | ^3.0 | ||
| 0.5.1 | ^3.0 | ||
| 0.5.0 | ^3.0 | ||
| 0.4.0 | ^3.0 | ||
| 0.3.1 | ^3.0 | ||
| 0.2.1 | ^3.0 | ||
| 0.2.0 | ^3.0 | ||
| 0.1.2 | ^3.0 | ||
| 0.1.1 | ^3.0 | ||
| 0.1.0 | ^3.0 |