Mdx/plugin unshift (#4248)
* Add builtin rehype plugin to beginning * Add Changeset * Do the same to rehypeRaw for consistency
This commit is contained in:
parent
d087286daa
commit
869d009359
2 changed files with 7 additions and 2 deletions
5
.changeset/fuzzy-emus-develop.md
Normal file
5
.changeset/fuzzy-emus-develop.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
'@astrojs/mdx': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Load builtin rehype plugins before user plugins instead of after
|
|
@ -62,10 +62,10 @@ function getRehypePlugins(
|
||||||
let rehypePlugins = handleExtends(mdxOptions.rehypePlugins, DEFAULT_REHYPE_PLUGINS);
|
let rehypePlugins = handleExtends(mdxOptions.rehypePlugins, DEFAULT_REHYPE_PLUGINS);
|
||||||
|
|
||||||
if (config.markdown.syntaxHighlight === 'shiki' || config.markdown.syntaxHighlight === 'prism') {
|
if (config.markdown.syntaxHighlight === 'shiki' || config.markdown.syntaxHighlight === 'prism') {
|
||||||
rehypePlugins.push([rehypeRaw, { passThrough: nodeTypes }]);
|
rehypePlugins.unshift([rehypeRaw, { passThrough: nodeTypes }]);
|
||||||
}
|
}
|
||||||
// getHeadings() is guaranteed by TS, so we can't allow user to override
|
// getHeadings() is guaranteed by TS, so we can't allow user to override
|
||||||
rehypePlugins.push(rehypeCollectHeadings);
|
rehypePlugins.unshift(rehypeCollectHeadings);
|
||||||
|
|
||||||
return rehypePlugins;
|
return rehypePlugins;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue