the /palette module provides extensions to the /artisan content processing utilities. it includes additional markdown tokens and rendering rules, as well as syntax highlighting integration.
resolvers
codeblock
import type { Resolver } from 'aubade/artisan';export const codeblock: Resolver<'block:code'>;
codeblock is a custom resolver for fenced code blocks which wraps the code in data-aubade block and adds syntax highlighting via shiki.
import { forge } from 'aubade/artisan';import { codeblock } from 'aubade/palette';const render = forge({renderers: { 'block:code': codeblock },});
include the stylesheet provided to ensure proper styling:
<script>import 'aubade/styles/code.css';</script>
highlight
interface Dataset {file?: string;language?: string;start?: string; // line number to start from[data: string]: string | undefined;}export function highlight(source: string, dataset: Dataset): string;
highlight() exposes Aubade’s syntax highlighter independently of the markdown compiler. use it for standalone code snippets or when integrating highlighting into third-party parsers.
import { highlight } from 'aubade/artisan';highlight('const x: number = 1;', { language: 'ts' });
or wire it into another parser:
import { highlight } from 'aubade/artisan';import markdown from 'markdown-it';const marker = markdown({highlight: (src, language) => `<pre>${highlight(src, { language })}</pre>`,});
shiki
import { shiki } from 'aubade/artisan';await shiki.codeToHtml('const x = 1', { lang: 'ts' });
Aubade exposes the underlying shiki highlighter instance. use this when you need full control over highlighting output.