@comark/html
v0.4.0
Published
HTML renderer for Comark (Components in Markdown)
Readme
@comark/html
Framework-free HTML renderer for Comark. Use it for SSR, static site generation, RSS feeds, emails, or anywhere you just need an HTML string.
Features
- 📦 No framework dependencies — pure HTML output
- 🎯 Map any Comark tag to a custom render function
- 🌊 Stream API for buffered/incremental rendering
- 🔌 Plugin ecosystem (math, mermaid, highlight, binding…)
- 🎯 Full TypeScript support
Installation
npm install @comark/html
# or
pnpm add @comark/htmlUsage
import { render } from '@comark/html'
const html = await render(`
# Getting Started
This is a **bold** statement with a [link](https://example.com).
- Item 1
- Item 2
`)<h1 id="getting-started">Getting Started</h1>
<p>This is a <strong>bold</strong> statement with a <a href="https://example.com">link</a>.</p>
<ul>
<li>Item 1</li>
<li>Item 2</li>
</ul>Custom components
import { render } from '@comark/html'
const html = await render(`::alert{type="warning"}\nHeads up!\n::`, {
components: {
alert: async ([, attrs, ...children], { render }) =>
`<div class="alert alert-${attrs.type}">${await render(children)}</div>`,
},
})Plugins
import { render } from '@comark/html'
import highlight from '@comark/html/plugins/highlight'
import githubLight from '@shikijs/themes/github-light'
import githubDark from '@shikijs/themes/github-dark'
const html = await render(content, {
plugins: [highlight({ themes: { light: githubLight, dark: githubDark } })],
})Documentation
Full guide and API reference at comark.dev/rendering/html.
License
Made with ❤️
Published under MIT License.
