From eb09b4ec2553ab5f6a98451ef41abe4b592405dc Mon Sep 17 00:00:00 2001 From: Alex Haslam Date: Wed, 4 Feb 2026 17:41:55 +0000 Subject: [PATCH] Add tab parameter --- exampleSite/content/docs/shortcodes/index.md | 5 +++-- layouts/shortcodes/accordionItem.html | 8 +++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/exampleSite/content/docs/shortcodes/index.md b/exampleSite/content/docs/shortcodes/index.md index d5bf0d60..e77c87bc 100644 --- a/exampleSite/content/docs/shortcodes/index.md +++ b/exampleSite/content/docs/shortcodes/index.md @@ -115,13 +115,14 @@ The alert sign (`+` or `-`) is optional to control whether the admonition is fol | `title` | **Required.** Title shown in the item header. | | `open` | **Optional.** Set to `true` to have the item open by default. | | `header` | **Optional.** Alias for `title`, kept for compatibility with other shortcodes. | +| `icon` | **Optional.** Icon name to display before the title. | **Example 1: `mode="open"` (multiple items can be open) + `separated=true`** ```md {{}} - {{}} + {{}} This item demonstrates Markdown rendering: - **Bold text** - Lists @@ -137,7 +138,7 @@ The alert sign (`+` or `-`) is optional to control whether the admonition is fol ``` {{< accordion mode="open" separated=true >}} - {{< accordionItem title="Markdown example" open=true >}} + {{< accordionItem title="Markdown example" icon="code" open=true >}} This item demonstrates Markdown rendering: - **Bold text** - Lists diff --git a/layouts/shortcodes/accordionItem.html b/layouts/shortcodes/accordionItem.html index 22a53f28..fa7819e3 100644 --- a/layouts/shortcodes/accordionItem.html +++ b/layouts/shortcodes/accordionItem.html @@ -6,6 +6,7 @@ {{ $isSeparated := or (eq $separated true) (eq $separated "true") }} {{ $title := .Get "title" | default (.Get "header") }} +{{ $icon := .Get "icon" }} {{ $md := .Get "md" | default true }} {{ $open := .Get "open" | default false }} {{ $isOpen := or (eq $open true) (eq $open "true") }} @@ -16,7 +17,12 @@ {{ if $isOpen }}open{{ end }} > - {{ $title }} + + {{ with $icon }} + {{ partial "icon.html" . }} + {{ end }} + {{ $title }} + {{ partial "icon" "chevron-down" }}