From 2ee71dc217aa38de044f0ba29c665c5a0f1200ac Mon Sep 17 00:00:00 2001 From: Shubham Padia Date: Mon, 26 Aug 2024 18:23:52 +0530 Subject: [PATCH 1/2] Aside: Add support for icons attribute. Only built-icons will be supported for now. This commit does not add support for the `:::` markdown shorthand for defining an aside, that will be done in the next commit. --- docs/src/content/docs/components/asides.mdx | 12 ++++++++++++ packages/starlight/user-components/Aside.astro | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/docs/src/content/docs/components/asides.mdx b/docs/src/content/docs/components/asides.mdx index a28375b0d60..9ccf1ff189c 100644 --- a/docs/src/content/docs/components/asides.mdx +++ b/docs/src/content/docs/components/asides.mdx @@ -49,6 +49,10 @@ Other content is also supported in asides. + + ```` @@ -73,6 +77,10 @@ Other content is also supported in asides. {% aside type="danger" %} Do not give your password to anyone. {% /aside %} + +{% aside icon="heart" %} +Aside with a custom icon. The icon must be part of starlight's icon list. +{% /aside %} ```` @@ -95,6 +103,10 @@ Do not give your password to anyone. + + diff --git a/packages/starlight/user-components/Aside.astro b/packages/starlight/user-components/Aside.astro index 471f2fa0ae1..cdb448d511f 100644 --- a/packages/starlight/user-components/Aside.astro +++ b/packages/starlight/user-components/Aside.astro @@ -12,7 +12,7 @@ interface Props { title?: string; } -let { type = 'note', title } = Astro.props; +let { type = 'note', title, icon } = Astro.props; if (!asideVariants.includes(type)) { throw new AstroError( @@ -30,7 +30,7 @@ if (!title) {