summaryrefslogtreecommitdiff
path: root/packages/markdown/remark/src/rehype-shiki.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/markdown/remark/src/rehype-shiki.ts')
-rw-r--r--packages/markdown/remark/src/rehype-shiki.ts16
1 files changed, 14 insertions, 2 deletions
diff --git a/packages/markdown/remark/src/rehype-shiki.ts b/packages/markdown/remark/src/rehype-shiki.ts
index fdab3ddf3..43b38f095 100644
--- a/packages/markdown/remark/src/rehype-shiki.ts
+++ b/packages/markdown/remark/src/rehype-shiki.ts
@@ -8,9 +8,21 @@ export const rehypeShiki: Plugin<[ShikiConfig?], Root> = (config) => {
let highlighterAsync: Promise<ShikiHighlighter> | undefined;
return async (tree) => {
- highlighterAsync ??= createShikiHighlighter(config);
+ highlighterAsync ??= createShikiHighlighter({
+ langs: config?.langs,
+ theme: config?.theme,
+ themes: config?.themes,
+ langAlias: config?.langAlias,
+ });
const highlighter = await highlighterAsync;
- await highlightCodeBlocks(tree, highlighter.highlight);
+ await highlightCodeBlocks(tree, (code, language, options) => {
+ return highlighter.codeToHast(code, language, {
+ meta: options?.meta,
+ wrap: config?.wrap,
+ defaultColor: config?.defaultColor,
+ transformers: config?.transformers,
+ });
+ });
};
};