summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.changeset/fuzzy-emus-develop.md5
-rw-r--r--packages/integrations/mdx/src/index.ts4
2 files changed, 7 insertions, 2 deletions
diff --git a/.changeset/fuzzy-emus-develop.md b/.changeset/fuzzy-emus-develop.md
new file mode 100644
index 000000000..b7b7321d6
--- /dev/null
+++ b/.changeset/fuzzy-emus-develop.md
@@ -0,0 +1,5 @@
+---
+'@astrojs/mdx': patch
+---
+
+Load builtin rehype plugins before user plugins instead of after
diff --git a/packages/integrations/mdx/src/index.ts b/packages/integrations/mdx/src/index.ts
index d88e67016..05b803705 100644
--- a/packages/integrations/mdx/src/index.ts
+++ b/packages/integrations/mdx/src/index.ts
@@ -62,10 +62,10 @@ function getRehypePlugins(
let rehypePlugins = handleExtends(mdxOptions.rehypePlugins, DEFAULT_REHYPE_PLUGINS);
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
- rehypePlugins.push(rehypeCollectHeadings);
+ rehypePlugins.unshift(rehypeCollectHeadings);
return rehypePlugins;
}