Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manually configure MDX integration #7972

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

bluwy
Copy link
Member

@bluwy bluwy commented Apr 22, 2024

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 our rehype-optimize-static plugin runs before rehype-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 after astro-expressive-code, however Starlight will always append astro-expressive-code, causing an error with the ordering. I fixed this by patching with integrations/mdx.ts, but this could perhaps be better supported in Starlight in the future.


Performance (Rollup build):

  • Before: 114s
  • After: 109s
  • After + astro-expressive-code latest: 99s

cc @hippotastic (Awesome work on the optimizations!)

Related issues & labels (optional)

  • Closes #
  • Suggested label:

Copy link

vercel bot commented Apr 22, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview Apr 22, 2024 10:20am
1 Ignored Deployment
Name Status Preview Updated (UTC)
docs-i18n ⬜️ Ignored (Inspect) Apr 22, 2024 10:20am

@sarah11918
Copy link
Member

@delucis @hippotastic - Can I leave this to you two?

@sarah11918 sarah11918 added the site improvement Some thing that improves the website functionality - ask @delucis for help! label Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
site improvement Some thing that improves the website functionality - ask @delucis for help!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants