Skip to content

Refactor Sätteri RTL code support plugin - #4114

Merged
delucis merged 5 commits into
mainfrom
chris/satteri-rtl-cide
Aug 4, 2026
Merged

delucis merged 5 commits into
mainfrom
chris/satteri-rtl-cide

Conversation

@delucis

@delucis delucis commented Aug 4, 2026 •

Copy link
Copy Markdown
Member

Description

  • Fixes our Sätteri plugin for supporting code in RTL documents in newer versions of Astro
  • Fixes the failing test in Update dependencies #4113
  • Sätteri now has a ctx.parent() we can use to get parents so we can remove the more convoluted code for working this out. Strictly speaking these do not work 1:1 — before, we’d skip applying attributes to a <code> element even if it was deeply nested in a <pre> whereas now we only skip if the <code> is a direct child of the <pre>. However, in practice, I think this covers all the scenarios we were intending?
  • Existing tests here should pass, showing that the changes work for people on older versions of Astro. And I ran the changes against Update dependencies #4113 too to ensure it fixes the failing test there.

@netlify

netlify Bot commented Aug 4, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for astro-starlight ready!

Name Link
🔨 Latest commit 275e454
🔍 Latest deploy log https://app.netlify.com/projects/astro-starlight/deploys/6a7220098fcd1300087b448d
😎 Deploy Preview https://deploy-preview-4114--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: 99 (🔴 down 1 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.

@changeset-bot

changeset-bot Bot commented Aug 4, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 275e454

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 Patch

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

@github-actions github-actions Bot added the 🌟 core Changes to Starlight’s main package label Aug 4, 2026
@astrobot-houston

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size
/index.html 6.14 KB (0%)
/_astro/*.js 25.35 KB (0%)
/_astro/*.css 14.7 KB (0%)

@HiDeoo HiDeoo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

However, in practice, I think this covers all the scenarios we were intending?

I guess so and something like <pre><span><code> or similar is probably not common but that makes it a different behavior between the Unified and Sätteri implementation of the same plugin. Would it work to walk ctx.parent() until reaching <pre> or the root?

Comment thread packages/starlight/integrations/satteri.ts Outdated
Co-Authored-By: HiDeoo <494699+HiDeoo@users.noreply.github.com>
@delucis

delucis commented Aug 4, 2026 •

Copy link
Copy Markdown
Member Author

Would it work to walk ctx.parent() until reaching \<pre\> or the root?

I think so? I assume that’s more expensive because you have to serialize the entire parent node tree. I asked Erika on Discord for her reaction.

that makes it a different behavior between the Unified and Sätteri implementation of the same plugin

Yeah, true. We could update the Unified implementation to match Sätteri instead if equivalence is important? That might be cheaper than adding a lot of recursion for “correctness” even though the use cases it covers are basically all unintended.


Edit: Erika said this kind of check will be cheap so I went ahead and pushed 275e454 which walks up the full tree. (For sanity, I also ported all the changes to the #4113 branch to double check it still fixes the test failure there and I confirmed it does.)

@HiDeoo HiDeoo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This looks perfect to me 🚀

Erika said this kind of check will be cheap so I went ahead and pushed 275e454 which walks up the full tree. (For sanity, I also ported all the changes to the #4113 branch to double check it still fixes the test failure there and I confirmed it does.)

Amazing, thanks for investigating and updating the PR, definitely feels better imo to have both implementations having the same behavior 🙌

@delucis
delucis merged commit 3e486fb into main Aug 4, 2026
16 checks passed
@delucis
delucis deleted the chris/satteri-rtl-cide branch August 4, 2026 18:21
@astrobot-houston astrobot-houston mentioned this pull request Aug 4, 2026
HiDeoo added a commit to HiDeoo/starlight that referenced this pull request Aug 16, 2026
* main: (219 commits)
  i18n(fr): update `authoring-content.mdx`, `i18n.mdx` & `plugins.md` (withastro#4128)
  i18n(de): update links to Astro docs (withastro#4126)
  Update `size-limit` config (withastro#4122)
  Replace 3 outdated links to Astro Docs (withastro#4120)
  [ci] release (withastro#4115)
  Update dependencies (withastro#4113)
  Add Astro LilyPond to Starlight showcase (withastro#4116)
  Refactor Sätteri RTL code support plugin (withastro#4114)
  Use pinned version of `pkg-pr-new` for preview releases (withastro#4111)
  chore(deps): update vite and rolldown (withastro#4108)
  i18n(ru): update translations (withastro#4107)
  [ci] release (withastro#4106)
  Add Forgejo icon (withastro#4102)
  [ci] format
  i18n(de): update `themes.mdx` (withastro#4104)
  i18n(de): update `plugins.mdx` (withastro#4103)
  i18n(de): update `community-content.mdx` (withastro#4101)
  [ci] release (withastro#4097)
  Fix union schema `extend` regression (withastro#4095)
  [ci] release (withastro#4090)
  ...
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants