Skip to content

Relax remark/rehype plugins usage#3332

Merged
delucis merged 13 commits intowithastro:mainfrom
HiDeoo:hd-remark-rehype-refactor
Nov 28, 2025
Merged

Relax remark/rehype plugins usage#3332
delucis merged 13 commits intowithastro:mainfrom
HiDeoo:hd-remark-rehype-refactor

Conversation

@HiDeoo
Copy link
Copy Markdown
Member

@HiDeoo HiDeoo commented Jul 22, 2025

Description

This draft PR is a follow-up to #3274 which restricted the usage of Starlight remark and rehype plugins to only Markdown and MDX content loaded using Starlight's docsLoader(). As initially discussed and based on feedback, this PR relaxes that restriction using a new markdown.processedDirs (temporary name to be discussed) option that allows specifying additional directories where Markdown content should be processed by Starlight's remark and rehype plugins.

A few key points:

  • As initially pointed out by Chris, checks are currently run by all Starlight remark and rehype plugins. If we're to potentially add more checks by allowing more directories, this PR felt like a good opportunity to refactor and limit the number of checks. Two ideas were envisaged:
    • Have some kind of "parent" plugin that runs the checks and then calls the other plugins if needed (this means 1 check for remark and 1 for rehype).
    • Have a remark plugin that runs before any other and using an approach similar to Astro saving a field in the vfile data, e.g. file.data.starlight.skip or something like that with a symbol, which plugins running after could check and decide if processing should continue or not (this means 1 check for both remark and rehype).
    • This PR explores the first option in a dedicated commit so we can easily revert/modify it if needed (personally not sure yet how I feel about it, need to take a step back).
  • I went with directories paths relative to the project root instead of something like globs for this first iteration. I still wonder if we need the extra complexity/flexibility/cost of globs or just specifying directories is enough.

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Jul 22, 2025

🦋 Changeset detected

Latest commit: 7fec8c2

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 Jul 22, 2025

Deploy Preview for astro-starlight ready!

Name Link
🔨 Latest commit 7fec8c2
🔍 Latest deploy log https://app.netlify.com/projects/astro-starlight/deploys/6929d2a2bc69df0008088ef5
😎 Deploy Preview https://deploy-preview-3332--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 project configuration.

@github-actions github-actions bot added 📚 docs Documentation website changes 🌟 core Changes to Starlight’s main package labels Jul 22, 2025
@astrobot-houston
Copy link
Copy Markdown
Contributor

astrobot-houston commented Jul 22, 2025

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 reference/configuration.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.

@alvinometric
Copy link
Copy Markdown
Contributor

markdown.includes ? Rather than processedDirs

@LasseRosenow
Copy link
Copy Markdown

LasseRosenow commented Oct 13, 2025

Is this still being worked on? We depend on it for our documentation, because we would like to make our guides not so much hidden inside the starlight folder, to make contribution more accessible :)

Right now we are working around it using symlinks, but it also creates problems of their own, see: #3470

@HiDeoo
Copy link
Copy Markdown
Member Author

HiDeoo commented Oct 13, 2025

Is this still being worked on?

Yes, this is not something we've been able to prioritize recently, but we do plan to get back to it and ship it in the next minor release hopefully.

@LasseRosenow
Copy link
Copy Markdown

That sounds amazing, thank you so much :)

* main: (87 commits)
  i18n(ja): sync outdated aside page (withastro#3465)
  i18n(ja): sync outdated icon reference (withastro#3467)
  chore(deps): update pnpm/action-setup action to v4.2.0 (withastro#3460)
  Showcase: Add Saucer (withastro#3454)
  i18n(ja): resources/themes (withastro#3442)
  add openstatus showcase (withastro#3436)
  [ci] release (withastro#3434)
  Add `head` config validation for `meta` tags with `content` (withastro#3380)
  Fix Astro Island margins in Markdown (withastro#3340)
  Ensure tab links span the full tab height (withastro#3427)
  Move `<summary>` to top of `<details>` for validity (withastro#3423)
  Run all tests on CI workflow changes (withastro#3433)
  [ci] format
  i18n(fr): small rewording and fixes in top-level pages (withastro#3432)
  i18n(fr): small rewording and fixes in `guides` (withastro#3431)
  i18n(fr): fix typo and links in `reference` files (withastro#3429)
  i18n(fr): small rewording in `components` (withastro#3430)
  [ci] release (withastro#3384)
  i18n(de): Update `page.lastUpdated` translation to be more in‐line with the English translation (withastro#3416)
  Remove invalid value attribute from `<select>` (withastro#3421)
  ...
@delucis delucis added the 🌟 minor Change that triggers a minor release label Oct 18, 2025
@delucis delucis added this to the v0.37 milestone Oct 18, 2025
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.

This looks great and also nice to see the cleaned up code with the file path checks all centralised.

Left a few quick nots from stuff I spotted, but nothing major from me I don’t think.

  • We’d discussed glob support, but I agree that the simple directories approach makes sense for now.

  • I don’t have any particularly good ideas for the option naming. I tried to think of something that didn’t use the abbreviated “dirs”, but “directories” is long and “dir” is very common usage already, so I think it’s already quite good. It think the “processed” part of the name is nicely explicit too.

Thanks @HiDeoo!

HiDeoo and others added 6 commits November 5, 2025 08:22
* main: (47 commits)
  feat: add some of trueberryless' new Starlight blogs to community content (withastro#3525)
  i18n(fr): update `resources/themes` (withastro#3526)
  Fix file filters added in withastro#3520 (withastro#3522)
  i18n(fr): update `guides/site-search.mdx` (withastro#3524)
  i18n(fr): update `resources/plugins.mdx` (withastro#3523)
  docs: add starlight-themes link (withastro#3510)
  i18n(de): update translation resources/plugins.mdx (withastro#3519)
  i18n(de): update translation guides/site-search.mdx (withastro#3518)
  Skip a11y CI checks for docs changes that aren’t tested anyway (withastro#3520)
  Speed up Linux e2e tests (withastro#3517)
  i18n(ru): update translations (withastro#3512)
  Tweak a11y e2e tests (withastro#3507)
  [ci] format
  docs(plugin): starlight-docsearch-typesense (withastro#3504)
  Add starlight-page-actions (withastro#3515)
  ci: update file icons (withastro#3511)
  [i18nIgnore] Match title case convention for components/using-components (withastro#3508)
  Disable Prettier on GitHub Actions workflow files (withastro#3509)
  [ci] release (withastro#3490)
  Update release workflow for OIDC (withastro#3500)
  ...
Co-authored-by: delucis <357379+delucis@users.noreply.github.com>
Co-authored-by: delucis <357379+delucis@users.noreply.github.com>
Co-authored-by: delucis <357379+delucis@users.noreply.github.com>
@HiDeoo
Copy link
Copy Markdown
Member Author

HiDeoo commented Nov 5, 2025

Thanks for the review 🙌

Updated the PR with the suggested changes, and commented on one of them but happy to discuss further!

I've also added a changeset for this new configuration option.

@delucis delucis marked this pull request as ready for review November 24, 2025 17:53
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.

Took the liberty of moving this out of draft so I can approve it! I think it’s not just ready for review, it’s ready to merge! 🚀 (Once we’re ready for the next minor of course.)

@delucis delucis added the ✅ approved Pull requests that have been approved and are ready to merge when next cutting a release label Nov 24, 2025
@delucis delucis merged commit f61f99d into withastro:main Nov 28, 2025
17 checks passed
@astrobot-houston astrobot-houston mentioned this pull request Nov 28, 2025
ArmandPhilippot added a commit to ArmandPhilippot/starlight that referenced this pull request Nov 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✅ approved Pull requests that have been approved and are ready to merge when next cutting a release 🌟 core Changes to Starlight’s main package 📚 docs Documentation website changes 🌟 minor Change that triggers a minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MDX :::note annotation not working with symlink

5 participants