mirror of
https://github.com/gohugoio/hugoDocs.git
synced 2025-09-13 12:45:52 -04:00
tpl/tplimpl: Add details shortcode
- Add new shortcode to render details HTML element. - Implement integration tests to check: default state, custom summary, open state, attribute sanitization, allowed attributes, and localization of default summary text. - Update docs to include details shortcode. Closes # 13090
This commit is contained in:
parent
8390a4a3ac
commit
f29f19afff
@ -94,6 +94,40 @@ Example usage:
|
|||||||
|
|
||||||
Although you can call this shortcode using the `{{</* */>}}` notation, computationally it is more efficient to call it using the `{{%/* */%}}` notation as shown above.
|
Although you can call this shortcode using the `{{</* */>}}` notation, computationally it is more efficient to call it using the `{{%/* */%}}` notation as shown above.
|
||||||
|
|
||||||
|
### details
|
||||||
|
|
||||||
|
{{< new-in 0.140.0 >}}
|
||||||
|
|
||||||
|
{{% note %}}
|
||||||
|
To override Hugo's embedded `details` shortcode, copy the [source code] to a file with the same name in the layouts/shortcodes directory.
|
||||||
|
|
||||||
|
This may be useful if you are wanting access to more global HTML attributes.
|
||||||
|
|
||||||
|
[source code]: {{% eturl details %}}
|
||||||
|
{{% /note %}}
|
||||||
|
|
||||||
|
Use the `details` shortcode to generate a collapsible details HTML element. For example:
|
||||||
|
|
||||||
|
```text
|
||||||
|
{{</* details summary="Custom Summary Text" */>}}
|
||||||
|
Showing custom `summary` text.
|
||||||
|
{{</* /details */>}}
|
||||||
|
```
|
||||||
|
|
||||||
|
Additional examples can be found in the source code. The `details` shortcode can use the following named arguments:
|
||||||
|
|
||||||
|
summary
|
||||||
|
: (`string`) Optional. Specifies the content of the child summary element. Default is "Details"
|
||||||
|
|
||||||
|
open
|
||||||
|
: (`bool`) Optional. Whether to initially display the contents of the details element. Default is `false`.
|
||||||
|
|
||||||
|
name
|
||||||
|
: (`string`) Optional. The value of the element's name attribute.
|
||||||
|
|
||||||
|
class
|
||||||
|
: (`string`) Optional. The value of the element's class attribute.
|
||||||
|
|
||||||
### figure
|
### figure
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
# Shortcodes
|
# Shortcodes
|
||||||
'comment' = 'shortcodes/comment.html'
|
'comment' = 'shortcodes/comment.html'
|
||||||
|
'details' = 'shortcodes/details.html'
|
||||||
'figure' = 'shortcodes/figure.html'
|
'figure' = 'shortcodes/figure.html'
|
||||||
'gist' = 'shortcodes/gist.html'
|
'gist' = 'shortcodes/gist.html'
|
||||||
'highlight' = 'shortcodes/highlight.html'
|
'highlight' = 'shortcodes/highlight.html'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user