blank project
This commit is contained in:
29
node_modules/@astrojs/markdown-remark/dist/rehype-shiki.js
generated
vendored
Normal file
29
node_modules/@astrojs/markdown-remark/dist/rehype-shiki.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
import { highlightCodeBlocks } from "./highlight.js";
|
||||
import { createShikiHighlighter } from "./shiki.js";
|
||||
const rehypeShiki = (config, excludeLangs) => {
|
||||
let highlighterAsync;
|
||||
return async (tree) => {
|
||||
highlighterAsync ??= createShikiHighlighter({
|
||||
langs: config?.langs,
|
||||
theme: config?.theme,
|
||||
themes: config?.themes,
|
||||
langAlias: config?.langAlias
|
||||
});
|
||||
const highlighter = await highlighterAsync;
|
||||
await highlightCodeBlocks(
|
||||
tree,
|
||||
(code, language, options) => {
|
||||
return highlighter.codeToHast(code, language, {
|
||||
meta: options?.meta,
|
||||
wrap: config?.wrap,
|
||||
defaultColor: config?.defaultColor,
|
||||
transformers: config?.transformers
|
||||
});
|
||||
},
|
||||
excludeLangs
|
||||
);
|
||||
};
|
||||
};
|
||||
export {
|
||||
rehypeShiki
|
||||
};
|
||||
Reference in New Issue
Block a user