diff --git a/exampleSite/content.en/docs/shortcodes/experimental/images.md b/exampleSite/content.en/docs/shortcodes/experimental/images.md index 24cd835..03414aa 100644 --- a/exampleSite/content.en/docs/shortcodes/experimental/images.md +++ b/exampleSite/content.en/docs/shortcodes/experimental/images.md @@ -10,7 +10,10 @@ Enhanced image display with click-to-expand behavior. ## Example -{{< image src="placeholder.svg" alt="Placeholder image" title="Click to expand" loading="lazy" >}} +{{% columns %}} +- {{< image src="placeholder.svg" alt="Placeholder image" title="Click to expand" loading="lazy" >}} +- {{< image src="placeholder.svg" alt="Placeholder image" title="Click to expand" loading="lazy" >}} +{{% /columns %}} ## Parameters diff --git a/layouts/_partials/docs/text/shortcode-id.html b/layouts/_partials/docs/text/shortcode-id.html new file mode 100644 index 0000000..a2a9b1b --- /dev/null +++ b/layouts/_partials/docs/text/shortcode-id.html @@ -0,0 +1,3 @@ +{{- $key := printf "book-%s-id" .Name }} +{{- .Page.Store.Add $key 1 -}} +{{- return .Page.Store.Get $key -}} diff --git a/layouts/_shortcodes/asciinema.html b/layouts/_shortcodes/asciinema.html index 2c36e79..2ca1f43 100644 --- a/layouts/_shortcodes/asciinema.html +++ b/layouts/_shortcodes/asciinema.html @@ -7,13 +7,14 @@ {{- .Page.Store.Set "asciinema" true -}} {{- end -}} +{{- $id := partial "docs/text/shortcode-id" . -}} {{- $href := (partial "docs/links/portable-image" (dict "Page" .Page "Destination" (.Get "cast"))) -}} {{- .Store.Set "asciinema" .Params -}} {{- .Store.DeleteInMap "asciinema" "cast" -}} {{- $attributes := partial "docs/text/mapper" (dict "attributes" (dict) "set" (dict - "id" (printf "asciinema-%d" .Ordinal) + "id" (printf "asciinema-%d" ($id)) "x-data-cast" $href "x-data-opts" (.Store.Get "asciinema" | jsonify) ) diff --git a/layouts/_shortcodes/columns.html b/layouts/_shortcodes/columns.html index a122062..58a2ad1 100644 --- a/layouts/_shortcodes/columns.html +++ b/layouts/_shortcodes/columns.html @@ -1,11 +1,12 @@ {{- $ratio := (split (.Get "ratio") ":") -}} +{{- $id := partial "docs/text/shortcode-id" . -}} {{- if strings.Contains .InnerDeindent "<--->" -}} {{- warnf "{{}} shortcode separator '<--->' is deprecated, use markdown list instead." -}} {{- $attributes := partial "docs/text/mapper" (dict "attributes" (cond .IsNamedParams .Params dict) "merge" (dict "class" (slice "book-columns" "flex" "flex-wrap") - "id" (printf "book-columns-%d" .Ordinal) + "id" (printf "book-columns-%d" $id) ) ) -}}
@@ -19,7 +20,7 @@ {{- else -}} {{- if .Get "ratio" -}}