svelte-markdoc-preprocess
svelte-markdoc-preprocess copied to clipboard
Feature request: custom fence/codeblock highlighting function in preprocessor config
Is your feature request related to a problem? Please describe. using shiki in fence component result in bad preformace in loading the page
Describe the solution you'd like better to use a highlighting function to avoid sending shiki to client like this example
//svelte.config.js
function customHighlighter (content: string, language:string ){
return shiki.codeToHtml(content, {
lang: language,
theme: 'github-dark',
transformers: [
transformerNotationDiff(),
transformerNotationErrorLevel(),
transformerNotationHighlight()
]
})
}
const config = {
preprocess: [
vitePreprocess(),
markdoc({
highlighter: customHighlighter
})
]
}
Describe alternatives you've considered n/a
Additional context n/a
It might be smart to add this, so far I have been relying on pre-rendering for this using SvelteKit 🤔
It's released now, not 100% happy yet with the implementation. Will wait a bit on adding it to the docs, however, you can use it and its passed as the default slot 👍🏻