details shortcode: add example of both alternatives (#783)

* details shortcode: add example of both alternatives
readme: mention steps shortcode, move katex alpha order
steps: use 1. instead of fixed numbers

* roll back steps.md

* positional vs argument. bonus typo fix
This commit is contained in:
nick n.
2025-11-18 08:48:54 +01:00
committed by GitHub
parent e08d9b796d
commit b7f9c8cb0f
3 changed files with 20 additions and 11 deletions
+3 -2
View File
@@ -287,9 +287,10 @@ In fact almost empty not quite empty because an empty file looks like absent for
- [Columns](https://hugo-book-demo.netlify.app/docs/shortcodes/columns/) - [Columns](https://hugo-book-demo.netlify.app/docs/shortcodes/columns/)
- [Details](https://hugo-book-demo.netlify.app/docs/shortcodes/details/) - [Details](https://hugo-book-demo.netlify.app/docs/shortcodes/details/)
- [Hints](https://hugo-book-demo.netlify.app/docs/shortcodes/hints/) - [Hints](https://hugo-book-demo.netlify.app/docs/shortcodes/hints/)
- [Mermaid](https://hugo-book-demo.netlify.app/docs/shortcodes/mermaid/)
- [Tabs](https://hugo-book-demo.netlify.app/docs/shortcodes/tabs/)
- [KaTeX](https://hugo-book-demo.netlify.app/docs/shortcodes/katex/) - [KaTeX](https://hugo-book-demo.netlify.app/docs/shortcodes/katex/)
- [Mermaid](https://hugo-book-demo.netlify.app/docs/shortcodes/mermaid/)
- [Steps](https://hugo-book-demo.netlify.app/docs/shortcodes/steps/)
- [Tabs](https://hugo-book-demo.netlify.app/docs/shortcodes/tabs/)
By default, Goldmark trims unsafe outputs which might prevent some shortcodes from rendering. It is recommended to set `markup.goldmark.renderer.unsafe=true` if you encounter problems. By default, Goldmark trims unsafe outputs which might prevent some shortcodes from rendering. It is recommended to set `markup.goldmark.renderer.unsafe=true` if you encounter problems.
@@ -1,22 +1,30 @@
# Details # Details
Details shortcode is a helper for `details` html5 element. It is going to replace `expand` shortcode. Details shortcode is a helper for `details` html5 element. To collapse the details either omit the `open`
keyword when using positional arguments or set `open=false` when using parameters.
## Example ## Example with positional arguments
```tpl ```tpl
{{%/* details "Title" [open] */%}} {{%/* details "Title" [open] */%}}
## Markdown content ## Markdown content
Lorem markdownum insigne... Lorem markdownum insigne...
{{%/* /details */%}} {{%/* /details */%}}
``` ```
```tpl
{{%/* details title="Title" open=true */%}}
## Markdown content
Lorem markdownum insigne...
{{%/* /details */%}}
```
{{% details "Title" open %}} {{% details "Title" open %}}
## Markdown content ## Markdown content
Lorem markdownum insigne... Lorem markdownum insigne...
{{% /details %}} {{% /details %}}
## Example with parameters
```tpl
{{%/* details title="Title" open=true */%}}
## Markdown content
Lorem markdownum insigne...
{{%/* /details */%}}
```
{{% details title="Title" open=true %}}
## Markdown content
Lorem markdownum insigne...
{{% /details %}}
+1 -1
View File
@@ -1,6 +1,6 @@
{{- $ratio := (split (.Get "ratio") ":") -}} {{- $ratio := (split (.Get "ratio") ":") -}}
{{- if strings.Contains .InnerDeindent "<--->" -}} {{- if strings.Contains .InnerDeindent "<--->" -}}
{{- warnf "Columns shortcode seprator '<--->' is deprecated, use markdown list instead." -}} {{- warnf "Columns shortcode separator '<--->' is deprecated, use markdown list instead." -}}
{{- $attributes := partial "docs/text/mapper" (dict {{- $attributes := partial "docs/text/mapper" (dict
"attributes" (cond .IsNamedParams .Params dict) "attributes" (cond .IsNamedParams .Params dict)
"merge" (dict "merge" (dict