Skip to content

Commit 0db71ae

Browse files
chgeobrc-dd
andauthored
docs: add info about the {open} attr for details container (#4067)
Co-authored-by: Divyansh Singh <[email protected]>
1 parent 8436472 commit 0db71ae

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

docs/en/guide/markdown.md

+24-2
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ You may set custom title by appending the text right after the "type" of the con
187187
Danger zone, do not proceed
188188
:::
189189

190-
::: details Click me to view the code
190+
::: details Click me to toggle the code
191191
```js
192192
console.log('Hello, VitePress!')
193193
```
@@ -200,7 +200,7 @@ console.log('Hello, VitePress!')
200200
Danger zone, do not proceed
201201
:::
202202

203-
::: details Click me to view the code
203+
::: details Click me to toggle the code
204204
```js
205205
console.log('Hello, VitePress!')
206206
```
@@ -225,6 +225,28 @@ export default defineConfig({
225225
})
226226
```
227227

228+
### Additional Attributes
229+
230+
You can add additional attributes to the custom containers. We use [markdown-it-attrs](https://github.com/arve0/markdown-it-attrs) for this feature, and it is supported on almost all markdown elements. For example, you can set the `open` attribute to make the details block open by default:
231+
232+
**Input**
233+
234+
````md
235+
::: details Click me to toggle the code {open}
236+
```js
237+
console.log('Hello, VitePress!')
238+
```
239+
:::
240+
````
241+
242+
**Output**
243+
244+
::: details Click me to toggle the code {open}
245+
```js
246+
console.log('Hello, VitePress!')
247+
```
248+
:::
249+
228250
### `raw`
229251

230252
This is a special container that can be used to prevent style and router conflicts with VitePress. This is especially useful when you're documenting component libraries. You might also wanna check out [whyframe](https://whyframe.dev/docs/integrations/vitepress) for better isolation.

0 commit comments

Comments
 (0)