Skip to content

Update Expressive Code and related packages#3109

Merged
delucis merged 4 commits intowithastro:mainfrom
dhruvkb:update_ec
Apr 14, 2025
Merged

Update Expressive Code and related packages#3109
delucis merged 4 commits intowithastro:mainfrom
dhruvkb:update_ec

Conversation

@dhruvkb
Copy link
Copy Markdown
Contributor

@dhruvkb dhruvkb commented Apr 13, 2025

Description

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 13, 2025

🦋 Changeset detected

Latest commit: 435ef9b

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

This PR includes changesets to release 2 packages
Name Type
@astrojs/starlight-markdoc Patch
@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 Apr 13, 2025
@netlify
Copy link
Copy Markdown

netlify bot commented Apr 13, 2025

Deploy Preview for astro-starlight ready!

Name Link
🔨 Latest commit 435ef9b
🔍 Latest deploy log https://app.netlify.com/sites/astro-starlight/deploys/67fccf3c2276d40008212d26
😎 Deploy Preview https://deploy-preview-3109--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

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

@dhruvkb dhruvkb marked this pull request as draft April 13, 2025 16:05
@dhruvkb
Copy link
Copy Markdown
Contributor Author

dhruvkb commented Apr 13, 2025

So it's going to be a bit more complex than just a version bump.

@HiDeoo
Copy link
Copy Markdown
Member

HiDeoo commented Apr 13, 2025

So it's going to be a bit more complex than just a version bump.

Thanks for the contribution 🙌

Not at a computer right now to take a very close look, but sharing a few early pointers regarding the issues:

  • The type errors are types tests in the Starlight code base that ensures feature parity between the Expressive Code <Code> component and its equivalent in the Starlight Markdoc preset. I'm assuming some props were updated/added in the <Code> component in this new version, and we probably need to reflect these changes in the Markdoc preset.
  • The accessibility warnings may be a bit more concerning, would probably need some investigation to see if it's a regression in the new version, some adjustments that need to be made in our EC configuration or something else.

Let me know if you want to me to take a closer look at any of these issues, give you a bit more guidance around them or if you want to take a stab at investigating them yourself. Thanks again for the contribution.

@delucis
Copy link
Copy Markdown
Member

delucis commented Apr 13, 2025

Thanks for the PR @dhruvkb and for taking an early look @HiDeoo. Probably good to ping @hippotastic on this too just so he’s aware!

Looking at the a11y errors, I spotted this difference for example:

Before This PR
highlighted code with a good text-to-background contrast ratio same code but the background is now darker failing the contrast ratio and there is a visible gap between the background colour and the highlight border

All the other failing contrast checks seem to be related to code marking styles too.

The error message in the <Code> types test are a bit confusing but I suspect the component may need updating for the new hangingIndent prop this release added.

@dhruvkb
Copy link
Copy Markdown
Contributor Author

dhruvkb commented Apr 13, 2025

The accessibility warnings are from upstream. Created this issue to track: expressive-code/expressive-code#323

@github-actions github-actions bot added the 🌟 markdoc Changes to Starlight’s Markdoc package label Apr 13, 2025
@hippotastic
Copy link
Copy Markdown
Contributor

Thank you for the ping! I'll release a fix in the next few minutes.

I think this shows how great it is to have automated a11y checks! I have some of my own in EC already, but apparently I'll need to upgrade them to use the same tool Starlight uses as well. :)

@hippotastic
Copy link
Copy Markdown
Contributor

hippotastic commented Apr 13, 2025

The patch is live now as EC version 0.41.1 on NPM. If you bump the version again to this patch, the tests should no longer fail.

@dhruvkb dhruvkb marked this pull request as ready for review April 13, 2025 20:53
@dhruvkb
Copy link
Copy Markdown
Contributor Author

dhruvkb commented Apr 14, 2025

Thanks @HiDeoo for looking into the PR and for the quick feedback on the failures, thanks @delucis for pointing out the new hangingIndent prop and thanks @hippotastic for patching and releasing v0.41.1 so quickly.

All checks are passing now, excited to be able to use this update!

@hippotastic
Copy link
Copy Markdown
Contributor

All checks are passing now, excited to be able to use this update!

Great work, this PR looks good to me!

In case you want to use your new EC feature before the next Starlight release, I'd like to point out that you can use the following method explained in the EC docs to use the latest version earlier:

https://expressive-code.com/upgrading/#overriding-expressive-code-within-starlight

@dhruvkb
Copy link
Copy Markdown
Contributor Author

dhruvkb commented Apr 14, 2025

Thanks @hippotastic, guess I should've read the manual. I could've avoided all this work 🤦‍♂️ for myself and everyone else here.

@hippotastic
Copy link
Copy Markdown
Contributor

I'm really grateful for your work contributing your new feature to EC and even making the version bump PR here that turned out to be more than a version bump!

Copy link
Copy Markdown
Member

@delucis delucis left a comment

Choose a reason for hiding this comment

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

Yes, it’s helpful for us to have PRs like this! We discovered a bug and @hippotastic and @dhruvkb fixed it 🎉

Thanks all around 🙌

@delucis delucis merged commit b5cc1b4 into withastro:main Apr 14, 2025
15 checks passed
@astrobot-houston astrobot-houston mentioned this pull request Apr 14, 2025
HiDeoo added a commit to HiDeoo/starlight that referenced this pull request Apr 14, 2025
* main: (31 commits)
  [ci] release (withastro#3091)
  i18n(de): update `environmental-impact` (withastro#3112)
  feat: update environment comparisons data (withastro#3097)
  chore(deps): update actions/setup-node action to v4.4.0 (withastro#3111)
  Update Expressive Code and related packages (withastro#3109)
  i18n(de): update `reference/overrides.md` (withastro#3093)
  i18n(de): update `reference/route-data.mdx` (withastro#3094)
  i18n(de): update `resources/themes.mdx` (withastro#3092)
  [ci] format
  i18n(zh-cn): Update configuration.mdx (withastro#3102)
  i18n(zh-cn): Update overrides.mdx (withastro#3103)
  [ci] format
  i18n(zh-cn): Add route-data.mdx (withastro#3106)
  [ci] format
  i18n(zh-cn): Add themes.mdx (withastro#3105)
  [ci] format
  i18n(zh-cn): Update plugins.md (withastro#3104)
  [ci] format
  i18n(zh-cn): Update customization.mdx (withastro#3101)
  i18n(zh-cn): Update badges.mdx (withastro#3100)
  ...
@dhruvkb dhruvkb deleted the update_ec branch April 14, 2025 18:36
Yoxnear pushed a commit to Yoxnear/starlight-custom that referenced this pull request Jul 23, 2025
Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
Co-authored-by: HiDeoo <494699+HiDeoo@users.noreply.github.com>
Co-authored-by: hippotastic <6137925+hippotastic@users.noreply.github.com>
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 🌟 markdoc Changes to Starlight’s Markdoc package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update astro-expressive-code to v0.41.0

4 participants