diff options
author | 2024-04-01 15:52:50 +0100 | |
---|---|---|
committer | 2024-04-01 22:52:50 +0800 | |
commit | 374efcdff9625ca43309d89e3b9cfc9174351512 (patch) | |
tree | 043c1e03c9cd46c1e83fa7362e42155f150f7b62 /packages/integrations/markdoc/src | |
parent | 31590d44ef8b7c96a757e9b835144d57d767383c (diff) | |
download | astro-374efcdff9625ca43309d89e3b9cfc9174351512.tar.gz astro-374efcdff9625ca43309d89e3b9cfc9174351512.tar.zst astro-374efcdff9625ca43309d89e3b9cfc9174351512.zip |
Lazy loaded shiki languages during syntax highlighting (#10618)
Diffstat (limited to 'packages/integrations/markdoc/src')
-rw-r--r-- | packages/integrations/markdoc/src/extensions/shiki.ts | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/packages/integrations/markdoc/src/extensions/shiki.ts b/packages/integrations/markdoc/src/extensions/shiki.ts index a39eb69a9..04fc8e867 100644 --- a/packages/integrations/markdoc/src/extensions/shiki.ts +++ b/packages/integrations/markdoc/src/extensions/shiki.ts @@ -11,12 +11,12 @@ export default async function shiki(config?: ShikiConfig): Promise<AstroMarkdocC nodes: { fence: { attributes: Markdoc.nodes.fence.attributes!, - transform({ attributes }) { + async transform({ attributes }) { // NOTE: The `meta` from fence code, e.g. ```js {1,3-4}, isn't quite supported by Markdoc. // Only the `js` part is parsed as `attributes.language` and the rest is ignored. This means // some Shiki transformers may not work correctly as it relies on the `meta`. const lang = typeof attributes.language === 'string' ? attributes.language : 'plaintext'; - const html = highlighter.highlight(attributes.content, lang); + const html = await highlighter.highlight(attributes.content, lang); // Use `unescapeHTML` to return `HTMLString` for Astro renderer to inline as HTML return unescapeHTML(html) as any; |