diff --git a/content/en/content-management/shortcodes.md b/content/en/content-management/shortcodes.md index 8e345f2fb..47e4f94ed 100644 --- a/content/en/content-management/shortcodes.md +++ b/content/en/content-management/shortcodes.md @@ -94,6 +94,50 @@ 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. +### 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. + +[source code]: {{% eturl details %}} +{{% /note %}} + +Use the `details` shortcode to create a `details` HTML element. For example: + +```text +{{}} +This is a **bold** word. +{{}} +``` + +Hugo renders this to: + +```html +
+ See the details +

This is a bold word.

+
+``` + +The details shortcode accepts these named arguments: + +summary +: (`string`) The content of the child `summary` element rendered from Markdown to HTML. Default is `Details`. + +open +: (`bool`) Whether to initially display the content of the `details` element. Default is `false`. + +class +: (`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 {{% note %}} diff --git a/data/embedded_template_urls.toml b/data/embedded_template_urls.toml index 38b437fe1..b7247f272 100644 --- a/data/embedded_template_urls.toml +++ b/data/embedded_template_urls.toml @@ -25,6 +25,7 @@ # Shortcodes 'comment' = 'shortcodes/comment.html' +'details' = 'shortcodes/details.html' 'figure' = 'shortcodes/figure.html' 'gist' = 'shortcodes/gist.html' 'highlight' = 'shortcodes/highlight.html'