diff options
author | 2023-09-07 22:28:02 +0800 | |
---|---|---|
committer | 2023-09-07 22:28:02 +0800 | |
commit | f3f62a5a20f4881bb04f65f192df8e1ccf7fb601 (patch) | |
tree | bcbae285c9ef23257c480861aa14622032a954d7 /packages/integrations/mdx/src/plugins.ts | |
parent | 0fa483283e54c94f173838cd558dc0dbdd11e699 (diff) | |
download | astro-f3f62a5a20f4881bb04f65f192df8e1ccf7fb601.tar.gz astro-f3f62a5a20f4881bb04f65f192df8e1ccf7fb601.tar.zst astro-f3f62a5a20f4881bb04f65f192df8e1ccf7fb601.zip |
Refactor mdx remark plugins (#8430)
Diffstat (limited to 'packages/integrations/mdx/src/plugins.ts')
-rw-r--r-- | packages/integrations/mdx/src/plugins.ts | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/packages/integrations/mdx/src/plugins.ts b/packages/integrations/mdx/src/plugins.ts index 5d7b9b58c..a3d9e4ff3 100644 --- a/packages/integrations/mdx/src/plugins.ts +++ b/packages/integrations/mdx/src/plugins.ts @@ -1,4 +1,9 @@ -import { rehypeHeadingIds, remarkCollectImages } from '@astrojs/markdown-remark'; +import { + rehypeHeadingIds, + remarkCollectImages, + remarkPrism, + remarkShiki, +} from '@astrojs/markdown-remark'; import { InvalidAstroDataError, safelyGetAstroData, @@ -16,8 +21,6 @@ import { rehypeInjectHeadingsExport } from './rehype-collect-headings.js'; import rehypeMetaString from './rehype-meta-string.js'; import { rehypeOptimizeStatic } from './rehype-optimize-static.js'; import { remarkImageToComponent } from './remark-images-to-component.js'; -import remarkPrism from './remark-prism.js'; -import remarkShiki from './remark-shiki.js'; import { jsToTreeNode } from './utils.js'; // Skip nonessential plugins during performance benchmark runs @@ -112,7 +115,7 @@ export async function getRemarkPlugins(mdxOptions: MdxOptions): Promise<Pluggabl if (!isPerformanceBenchmark) { // Apply syntax highlighters after user plugins to match `markdown/remark` behavior if (mdxOptions.syntaxHighlight === 'shiki') { - remarkPlugins.push([await remarkShiki(mdxOptions.shikiConfig)]); + remarkPlugins.push([remarkShiki, mdxOptions.shikiConfig]); } if (mdxOptions.syntaxHighlight === 'prism') { remarkPlugins.push(remarkPrism); |