VitePress
Using Comark component syntax natively in VitePress via the comark syntax plugin.
demo.md
# Comark Demo
This page uses [Comark syntax](https://github.com/comarkdown/comark) directly in VitePress Markdown — no wrapper component needed.
The `comark/plugins/syntax` plugin is added to VitePress's markdown-it config, enabling the `::` component syntax natively.
## Alerts
::alert{type="info"}
This is an **info** alert rendered using a Vue component registered in the VitePress theme.
::
::alert{type="success"}
Comark's component syntax works natively alongside VitePress's own Markdown features.
::
::alert{type="warning"}
Make sure to register your components globally in the VitePress theme.
::
::alert{type="danger"}
This is a danger alert — useful for critical warnings.
::
## How it works
1. Add `comark/plugins/syntax` to VitePress's markdown-it config
2. Register Vue components globally in the theme
3. Write `::component{props}` syntax directly in your `.md` files
```ts
// .vitepress/config.ts
import { markdownItComark } from 'comark/plugins/syntax'
export default defineConfig({
markdown: {
config(md) {
md.use(markdownItComark)
},
},
})
```
## Mixed content
You can mix Comark components with standard VitePress Markdown features:
- **Bold**, *italic*, and `inline code`
- [Links](https://github.com/comarkdown/comark) work as expected
- Tables, code blocks, and all VitePress extensions are unaffected
::alert{type="info"}
This alert sits right next to standard Markdown — everything coexists naturally.
::
This example shows how to use Comark's :: component syntax natively in VitePress — no wrapper component or custom renderer needed.
How it works
comark/plugins/syntaxplugin — Added to VitePress's markdown-it config viamarkdown.config(md), this enables the::component{props}syntax at the markdown-it level.- Global component registration — Vue components like
Alertare registered globally in the VitePress theme viaenhanceApp, so::alert{type="info"}resolves to the<Alert>component. - Native coexistence — Comark syntax works alongside all VitePress Markdown features (code blocks, tables, custom containers, GitHub alerts, etc.) since both use markdown-it.