Manually configure MDX integration #7972
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description (required)
With the upcoming upgrade to
astro-expressive-code
from Starlight (withastro/starlight#1720), I decided to test it out and found issues with the syntax highlighting. Because ourrehype-optimize-static
plugin runs beforerehype-expressive-code
, it wasn't able to highlight any code blocks because the elements has been optimized as plain strings.rehype-optimize-static
needs to be last for it to work correctly. This is already guaranteed by the@astrojs/mdx
optimize
option. So in this PR, I decided to use it instead.However, manually configuring
@astrojs/mdx
is tricky because it needs to be afterastro-expressive-code
, however Starlight will always appendastro-expressive-code
, causing an error with the ordering. I fixed this by patching withintegrations/mdx.ts
, but this could perhaps be better supported in Starlight in the future.Performance (Rollup build):
astro-expressive-code
latest: 99scc @hippotastic (Awesome work on the optimizations!)
Related issues & labels (optional)