diff options
Diffstat (limited to 'packages/integrations')
-rw-r--r-- | packages/integrations/mdx/src/plugins.ts | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/packages/integrations/mdx/src/plugins.ts b/packages/integrations/mdx/src/plugins.ts index 77c76243c..e1640238f 100644 --- a/packages/integrations/mdx/src/plugins.ts +++ b/packages/integrations/mdx/src/plugins.ts @@ -65,12 +65,17 @@ function getRehypePlugins(mdxOptions: MdxOptions): PluggableList { [rehypeRaw, { passThrough: nodeTypes }], ]; - if (!isPerformanceBenchmark) { + const syntaxHighlight = mdxOptions.syntaxHighlight; + if (syntaxHighlight && !isPerformanceBenchmark) { + const syntaxHighlightType = + typeof syntaxHighlight === 'string' ? syntaxHighlight : syntaxHighlight?.type; + const excludeLangs = + typeof syntaxHighlight === 'object' ? syntaxHighlight?.excludeLangs : undefined; // Apply syntax highlighters after user plugins to match `markdown/remark` behavior - if (mdxOptions.syntaxHighlight === 'shiki') { - rehypePlugins.push([rehypeShiki, mdxOptions.shikiConfig]); - } else if (mdxOptions.syntaxHighlight === 'prism') { - rehypePlugins.push(rehypePrism); + if (syntaxHighlightType === 'shiki') { + rehypePlugins.push([rehypeShiki, mdxOptions.shikiConfig, excludeLangs]); + } else if (syntaxHighlightType === 'prism') { + rehypePlugins.push([rehypePrism, excludeLangs]); } } |