Markdown loader plugin for bongo, powered by md4x.
bun add @bongo/markdown
import { markdown } from '@bongo/markdown';
export default {
plugins: [
markdown(),
],
};
The plugin registers an .md loader. Markdown files are converted to HTML content files and frontmatter is exposed as page metadata.
---
title: Hello
tags: docs, markdown
---
# Hello
markdown() accepts md4x HTML options. Syntax highlighting is optional:
import { markdown } from '@bongo/markdown';
import { shiki } from '@bongo/markdown/highlight';
export default {
plugins: [
markdown({
highlighter: shiki({
theme: 'github-dark',
langs: ['js', 'ts', 'css', 'bash'],
}),
}),
],
};
Install the highlighter package you want to use:
bun add shiki
bun add sugar-high
Then import from @bongo/markdown/highlight:
import { shiki, sugarhigh } from '@bongo/markdown/highlight';
shiki(options) loads Shiki with the requested theme and languages.
sugarhigh() loads Sugar High.