Skip to content

feat: add support for Astro 6.4 and Sätteri#3923

Open
Princesseuh wants to merge 23 commits into
mainfrom
feat/astro-640
Open

feat: add support for Astro 6.4 and Sätteri#3923
Princesseuh wants to merge 23 commits into
mainfrom
feat/astro-640

Conversation

@Princesseuh
Copy link
Copy Markdown
Member

@Princesseuh Princesseuh commented May 27, 2026

Description

This PR adds support for Astro 6.4 and the Sätteri processor introduced in that version. It does so by checking what (if any) markdown.processor is set, and adding plugins accordingly to that.

Versions earlier than 6.4 are also still supported, when markdown.processor isn't present, Starlight pushes plugins to the now deprecated remarkPlugins / rehypePlugins options instead.

This PR does not remove the hard dependency on @astrojs/markdown-remark, it would be possible to with similar patterns as the ones done for Sätteri, but I figured that it wasn't up to me to decide that.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 27, 2026

🦋 Changeset detected

Latest commit: ba14d55

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@astrojs/starlight Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@netlify
Copy link
Copy Markdown

netlify Bot commented May 27, 2026

Deploy Preview for astro-starlight ready!

Name Link
🔨 Latest commit ba14d55
🔍 Latest deploy log https://app.netlify.com/projects/astro-starlight/deploys/6a23e54278a65700087c5b92
😎 Deploy Preview https://deploy-preview-3923--astro-starlight.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 100 (no change from production)
Accessibility: 100 (no change from production)
Best Practices: 100 (no change from production)
SEO: 100 (no change from production)
PWA: -
View the detailed breakdown and full score reports
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@astrobot-houston
Copy link
Copy Markdown
Contributor

Hello! Thank you for opening your first PR to Starlight! ✨

Here’s what will happen next:

  1. Our GitHub bots will run to check your changes.
    If they spot any issues you will see some error messages on this PR.
    Don’t hesitate to ask any questions if you’re not sure what these mean!

  2. In a few minutes, you’ll be able to see a preview of your changes on Netlify 🤩

  3. One or more of our maintainers will take a look and may ask you to make changes.
    We try to be responsive, but don’t worry if this takes a few days.

@github-actions github-actions Bot added the 🌟 core Changes to Starlight’s main package label May 27, 2026
@astrobot-houston
Copy link
Copy Markdown
Contributor

astrobot-houston commented May 28, 2026

size-limit report 📦

Path Size
/index.html 5.61 KB (+0.02% 🔺)
/_astro/*.js 26.06 KB (0%)
/_astro/*.css 16.12 KB (0%)

Comment thread packages/starlight/package.json Outdated
@github-actions github-actions Bot added the 📚 docs Documentation website changes label Jun 1, 2026
@Princesseuh Princesseuh marked this pull request as ready for review June 1, 2026 11:38
@astrobot-houston
Copy link
Copy Markdown
Contributor

astrobot-houston commented Jun 1, 2026

Lunaria Status Overview

🌕 This pull request will trigger status changes.

Learn more

By default, every PR changing files present in the Lunaria configuration's files property will be considered and trigger status changes accordingly.

You can change this by adding one of the keywords present in the ignoreKeywords property in your Lunaria configuration file in the PR's title (ignoring all files) or by including a tracker directive in the merged commit's description.

Tracked Files

Locale File Note
en guides/authoring-content.mdx Source changed, localizations will be marked as outdated.
Warnings reference
Icon Description
🔄️ The source for this localization has been updated since the creation of this pull request, make sure all changes in the source have been applied.

HiDeoo
HiDeoo previously requested changes Jun 1, 2026
Copy link
Copy Markdown
Member

@HiDeoo HiDeoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot 🙌 This is definitely one impressive first PR 😅

I didn't get the time to go over all the changes yet or play enough with the code, but I'm sharing some initial thoughts and questions.

On a more global level, I'm a bit confused on how to use the new processor with our docs, e.g. if I install @astrojs/markdown-satteri in our docs/ directory, and set markdown: { processor: satteri() }, I get the following error:

❯ nr dev
$ astro dev
17:33:37 [ERROR] [@astrojs/starlight] An unhandled error occurred while running the "astro:config:setup" hook
Vite module runner has been closed.
  Location:
    /Users/hideo/Temp/starlight/node_modules/.pnpm/vite@7.3.2_@types+node@24.12.4_jiti@2.6.1_lightningcss@1.32.0_yaml@2.8.3/node_modules/vite/dist/node/module-runner.js:1081:26
  Stack trace:
    at ModuleRunner.getModuleInformation (file:///Users/hideo/Temp/starlight/node_modules/.pnpm/vite@7.3.2_@types+node@24.12.4_jiti@2.6.1_lightningcss@1.32.0_yaml@2.8.3/node_modules/vite/dist/node/module-runner.js:1081:26)
    at request (file:///Users/hideo/Temp/starlight/node_modules/.pnpm/vite@7.3.2_@types+node@24.12.4_jiti@2.6.1_lightningcss@1.32.0_yaml@2.8.3/node_modules/vite/dist/node/module-runner.js:1103:94)
    at astro:config:setup (/Users/hideo/Temp/starlight/packages/starlight/index.ts:98:73)
    at async runHookInternal (file:///Users/hideo/Temp/starlight/node_modules/.pnpm/astro@6.4.2_@types+node@24.12.4_jiti@2.6.1_lightningcss@1.32.0_rollup@4.53.3_yaml@2.8.3/node_modules/astro/dist/integrations/hooks.js:52:5)
    at async createContainer (file:///Users/hideo/Temp/starlight/node_modules/.pnpm/astro@6.4.2_@types+node@24.12.4_jiti@2.6.1_lightningcss@1.32.0_rollup@4.53.3_yaml@2.8.3/node_modules/astro/dist/core/dev/container.js:21:14)
[ELIFECYCLE] Command failed with exit code 1.

One last point, if someone configures markdown: { processor: unified() }, or not configure any processor at all, I wonder if the deprecation log could be a bit annoying:

[astro] `markdown.remarkPlugins`, `markdown.rehypePlugins`, and `markdown.remarkRehype` are deprecated. Pass them to `unified({...})` from `@astrojs/markdown-remark` directly instead.

Comment thread packages/starlight/index.ts Outdated
Comment thread .changeset/satteri-support.md Outdated
Comment thread packages/starlight/integrations/satteri.ts Outdated
Comment thread packages/starlight/__tests__/remark-rehype/anchor-links.test.ts Outdated
Comment thread packages/starlight/__tests__/satteri/asides.test.ts Outdated
Comment thread packages/starlight/__tests__/satteri/asides.test.ts Outdated
Comment thread packages/starlight/integrations/satteri.ts
Comment thread packages/starlight/integrations/remark-rehype.ts Outdated
@Princesseuh Princesseuh marked this pull request as draft June 1, 2026 23:46
@Princesseuh
Copy link
Copy Markdown
Member Author

Quick status update here, Starlight's tests found an actual issue in Sätteri that I'm fixing here: bruits/satteri#68

Comment on lines +191 to +195
function ltrRawPre(value: string): string | null {
const openTag = value.match(rawPreOpenTag)?.[0];
if (!openTag || /\sdir\s*=/.test(openTag)) return null;
return value.replace(openTag, () => `<pre dir="ltr"${openTag.slice(4)}`);
}
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is something unfortunate I didn't realize, when I did shiki highlighting in Astro for Sätteri, I figured that using toHTML (or whatever it's called) is fine (and much faster), but I didn't realize it meant plugins can't interact with the shiki HAST in other plugins. Something to fix in Astro, or tolerate for now, I guess...

@Princesseuh Princesseuh marked this pull request as ready for review June 3, 2026 13:30
@Princesseuh Princesseuh requested a review from HiDeoo June 3, 2026 14:26
Comment thread packages/starlight/package.json Outdated
@Princesseuh Princesseuh dismissed HiDeoo’s stale review June 3, 2026 15:50

PR has been redone

Copy link
Copy Markdown
Member

@HiDeoo HiDeoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update 🙌 The new changes looks really great and I really like the non-duplicated tests 👏 Adding some new comments and suggestions for now and I'll continue to play around with the PR tomorrow.

Also, I can now set markdown: { processor: satteri() }, in the docs/ and I no longer get the error I mentioned in my previous review (I installed "@astrojs/markdown-satteri": "https://pkg.pr.new/@astrojs/markdown-satteri@16955?t=1780458151"). Altho, it looks code blocks are not processed by Expressive Code, or using Astro's Shiki highlighter?

Once this is fixed, I'll run our visual diff checker on all our docs pages (and same on Astro Docs) for sanity (doing it now would highlight all code blocks on every pages).

Comment thread packages/starlight/integrations/markdown-plugins.ts Outdated
Comment thread packages/starlight/integrations/markdown-plugins.ts Outdated
Comment thread packages/starlight/package.json Outdated
Comment thread pnpm-workspace.yaml Outdated
Comment thread packages/starlight/integrations/markdown-plugins.ts
Comment thread packages/starlight/integrations/satteri.ts Outdated
@HiDeoo
Copy link
Copy Markdown
Member

HiDeoo commented Jun 6, 2026

Just pushed 2 new changes to the PR:

1. An error is now thrown when Sätteri is used with Starlight saying that the Sätteri Markdown processor is not yet compatible with Starlight.

For the reasoning behind this, we discussed with @delucis the current state and came up with the following conclusions:

  • Expressive Code is a core feature of Starlight, it brings some features that users expect (e.g. copy button) and some that are key Starlight features (e.g. ensuring proper color contrast of code blocks). It feels a bit weird to say "We support Sätteri but to get the full Starlight experience, you cannot have code blocks".
  • Right now, if we were to support Sätteri, we would have a very strong signal (an error being thrown) to signal to users that they must disable Expressive Code to use Sätteri. Once Expressive Code is updated and compatible with Sätteri, we wouldn't have an equally strong signal to say "You can now use Expressive Code again". While it can obviously be communicated in the changeset, it would be missed by many users (and we can't obviously just check if expressiveCode is disabled and then log a warning as some users might have it disabled for other reasons).
  • All the work in this PR and reviews is not wasted, and as soon as Expressive Code is compatible with Sätteri, we can just update it, remove the error, and have proper Sätteri support in Starlight released very quickly.
  • It would probably not give a good first impression to users to have Sätteri "kinda work" with Starlight but then have key features not working. Having a future release where we can just say "Sätteri is now supported" and have it work well with all features seems like a better experience and would probably lead to a better reception imo.

2. The second change I did is remove all the logic related to Astro 6.0–6.3 support and the nwo legacy markdown.{remark,rehype}Plugins keys.

  • If the PR initially aimed to support such versions, we discovered this PR requires a peer dependency on Astro 6.4, which means we should be able to drop that logic and code paths now.
  • May need to confirm this one with @Princesseuh to make sure I didn't forget about any edge cases.

Let me know what you all think about these changes.

@Princesseuh
Copy link
Copy Markdown
Member Author

Sure, no worries. Will try to work on finishing the expressive code PR as soon as possible. Maybe by then I'll also have fixed a few of the rough edges this PR works around right now.

As I'm currently on sick leave (one must wonder why I'm on GitHub dot com) it might take time, but hopefully there's not much work left on the currently open PR there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🌟 core Changes to Starlight’s main package 📚 docs Documentation website changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tables not being rendered anymore

4 participants