You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- 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
Copy file name to clipboardExpand all lines: docs/content/en/content-management/shortcodes.md
+34
Original file line number
Diff line number
Diff line change
@@ -94,6 +94,40 @@ Example usage:
94
94
95
95
Although you can call this shortcode using the `{{</* */>}}` notation, computationally it is more efficient to call it using the `{{%/* */%}}` notation as shown above.
96
96
97
+
### details
98
+
99
+
{{< new-in 0.140.0 >}}
100
+
101
+
{{% note %}}
102
+
To override Hugo's embedded `details` shortcode, copy the [source code] to a file with the same name in the layouts/shortcodes directory.
103
+
104
+
This may be useful if you are wanting access to more global HTML attributes.
105
+
106
+
[source code]: {{% eturl details %}}
107
+
{{% /note %}}
108
+
109
+
Use the `details` shortcode to generate a collapsible details HTML element. For example:
110
+
111
+
```text
112
+
{{</* details summary="Custom Summary Text" */>}}
113
+
Showing custom `summary` text.
114
+
{{</* /details */>}}
115
+
```
116
+
117
+
Additional examples can be found in the source code. The `details` shortcode can use the following named arguments:
118
+
119
+
summary
120
+
: (`string`) Optional. Specifies the content of the child summary element. Default is "Details"
121
+
122
+
open
123
+
: (`bool`) Optional. Whether to initially display the contents of the details element. Default is `false`.
124
+
125
+
name
126
+
: (`string`) Optional. The value of the element's name attribute.
127
+
128
+
class
129
+
: (`string`) Optional. The value of the element's class attribute.
0 commit comments