mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-20 21:31:32 +02:00
tpl/tplimpl: Update details shortcode
- Remove localization of default summary value - Add title attribute - Reformat to be consistent with other embedded templates - Simplify and improve integration test - Update documentation
This commit is contained in:
committed by
Bjørn Erik Pedersen
parent
641d2616c7
commit
1e34e5b26d
@@ -101,32 +101,42 @@ Although you can call this shortcode using the `{{</* */>}}` notation, computati
|
||||
{{% 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:
|
||||
Use the `details` shortcode to create a `details` HTML element. For example:
|
||||
|
||||
```text
|
||||
{{</* details summary="Custom Summary Text" */>}}
|
||||
Showing custom `summary` text.
|
||||
{{</* details summary="See the details" */>}}
|
||||
This is a **bold** word.
|
||||
{{</* /details */>}}
|
||||
```
|
||||
|
||||
Additional examples can be found in the source code. The `details` shortcode can use the following named arguments:
|
||||
Hugo renders this to:
|
||||
|
||||
```html
|
||||
<details>
|
||||
<summary>See the details</summary>
|
||||
<p>This is a <strong>bold</strong> word.</p>
|
||||
</details>
|
||||
```
|
||||
|
||||
The details shortcode accepts these named arguments:
|
||||
|
||||
summary
|
||||
: (`string`) Optional. Specifies the content of the child summary element. Default is "Details"
|
||||
: (`string`) The content of the child `summary` element rendered from Markdown to HTML. 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.
|
||||
: (`bool`) Whether to initially display the content of the `details` element. Default is `false`.
|
||||
|
||||
class
|
||||
: (`string`) Optional. The value of the element's class attribute.
|
||||
: (`string`) The value of the element's `class` attribute.
|
||||
|
||||
name
|
||||
: (`string`) The value of the element's `name` attribute.
|
||||
|
||||
title
|
||||
: (`string`) The value of the element's `title` attribute.
|
||||
|
||||
### figure
|
||||
|
||||
|
Reference in New Issue
Block a user