From b26238f22990dcf8ba002bea6a50c66f20ad5786 Mon Sep 17 00:00:00 2001 From: HiDeoo Date: Fri, 5 Apr 2024 14:50:05 +0200 Subject: Fix nested aside title rendering issue (#1703) --- .changeset/clean-squids-sparkle.md | 5 ++++ .../__tests__/remark-rehype/asides.test.ts | 29 ++++++++++++++++++++ .../snapshots/nested-asides-custom-titles.html | 1 + packages/starlight/integrations/asides.ts | 32 +++++++++++----------- packages/starlight/package.json | 1 - pnpm-lock.yaml | 11 -------- 6 files changed, 51 insertions(+), 28 deletions(-) create mode 100644 .changeset/clean-squids-sparkle.md create mode 100644 packages/starlight/__tests__/remark-rehype/snapshots/nested-asides-custom-titles.html diff --git a/.changeset/clean-squids-sparkle.md b/.changeset/clean-squids-sparkle.md new file mode 100644 index 00000000..238e3bad --- /dev/null +++ b/.changeset/clean-squids-sparkle.md @@ -0,0 +1,5 @@ +--- +'@astrojs/starlight': patch +--- + +Fixes aside custom titles rendering for nested asides. diff --git a/packages/starlight/__tests__/remark-rehype/asides.test.ts b/packages/starlight/__tests__/remark-rehype/asides.test.ts index ba3548c9..cb145e12 100644 --- a/packages/starlight/__tests__/remark-rehype/asides.test.ts +++ b/packages/starlight/__tests__/remark-rehype/asides.test.ts @@ -106,6 +106,35 @@ Nested tip. expect(res.code).toMatchFileSnapshot('./snapshots/nested-asides.html'); }); +test('nested asides with custom titles', async () => { + const res = await processor.render(` +:::::caution[Caution with a custom title] +Nested caution. + +::::note +Nested note. + +:::tip[Tip with a custom title] +Nested tip. +::: + +:::: + +::::: +`); + const labels = [...res.code.matchAll(/aria-label="(?