Fix nested aside title rendering issue#1703
Merged
delucis merged 1 commit intowithastro:mainfrom Apr 5, 2024
Merged
Conversation
🦋 Changeset detectedLatest commit: a2f6925 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
HiDeoo
commented
Apr 2, 2024
Comment on lines
+128
to
+134
| expect(labels).toMatchInlineSnapshot(` | ||
| [ | ||
| "Caution with a custom title", | ||
| "Note", | ||
| "Tip with a custom title", | ||
| ] | ||
| `); |
Member
Author
There was a problem hiding this comment.
Even if the snapshot can be used to ensure custom titles are properly rendered, I added this small expectation to make it easier to glance at what the expected output is instead of having to read the snapshot file.
Merged
HiDeoo
added a commit
to HiDeoo/starlight
that referenced
this pull request
Apr 5, 2024
* main: (111 commits) Fix various Expressive Code translation issues (withastro#1708) Fix nested aside title rendering issue (withastro#1703) I18n(pt-PT): Add resources pages (withastro#1678) Add SST Ion & Font Awesome to site showcase (withastro#1710) [ci] format Add SudoVanilla to showcase (withastro#1702) i18n(fr): Update `resources-showcase` (withastro#1697) [i18nIgnore] docs: update `starlight-links-validator` to version `0.7.1` (withastro#1696) [ci] format [ci] release (withastro#1688) [ci] format Update Russian translation (withastro#1616) [ci] format Adds `starlight` icon to Starlight (withastro#1698) Update Icons.ts with Farcaster Purple for SocialIcons (withastro#1622) Remove duplicate from showcase example in `contributing.md` (withastro#1692) i18n(zh-cn): Update `showcase.mdx` (withastro#1689) [ci] format i18n(zh-cn): Update configuration.mdx (withastro#1691) i18n(ko-KR): update `showcase.mdx` (withastro#1690) ...
HiDeoo
added a commit
to HiDeoo/starlight
that referenced
this pull request
Apr 8, 2024
* main: [ci] format [ci] release (withastro#1714) Fix various Expressive Code translation issues (withastro#1708) Fix nested aside title rendering issue (withastro#1703) I18n(pt-PT): Add resources pages (withastro#1678) Add SST Ion & Font Awesome to site showcase (withastro#1710)
Yoxnear
pushed a commit
to Yoxnear/starlight-custom
that referenced
this pull request
Jul 23, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What kind of changes does this PR include?
Description
This PR fixes an issue with nested asides using custom titles where nested custom titles would not be rendered and the outer most custom title would be the one of the inner most aside.
This behavior was caused by the assumption that
remark-directivestores the custom title of a container in a paragraph node added to its children. To remove such node, the current code would useunist-util-removeto remove this specific paragraph. However, this approach is incorrect asunist-util-removeiterates recursively through all children of a node, which means that if a nested aside had a custom title, the paragraph node containing its custom title would be removed by the outer aside.The spec of
mdast-util-directiveis also a bit more precise about the structure of a container with a custom title. It states that:As the label would always be a paragraph added as the head of the content of a container, we can entirely remove the iteration step and directly remove the first child of a container if it is a paragraph with a
directiveLabelfield set totrue.