highlighter-typst
Usage with highlight.js
:
<script
id="script-main"
src="https://cdn.jsdelivr.net/npm/@myriaddreamin/highlighter-typst/dist/cjs/contrib/hljs/typst.bundle.js"
></script>
<script>
const run = $typst$parserModule.then(() => {
hljs.registerLanguage(
'typst',
window.hljsTypst({
codeBlockDefaultLanguage: 'typst',
}),
);
document.getElementById('script-main').onload = run;
run();
</script>
Documentation for highlight.js
apis:
export function hljsTypst(options?: TypstHljsOptions);
export interface TypstHljsOptions {
handleCodeBlocks?: boolean | ((code: string, emitter: any) => boolean);
codeBlockDefaultLanguage?: string;
}