Skip to content

Commit

Permalink
docs: add info about the {open} attr for details container (#4067)
Browse files Browse the repository at this point in the history
Co-authored-by: Divyansh Singh <[email protected]>
  • Loading branch information
chgeo and brc-dd authored Oct 12, 2024
1 parent 8436472 commit 0db71ae
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions docs/en/guide/markdown.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ You may set custom title by appending the text right after the "type" of the con
Danger zone, do not proceed
:::

::: details Click me to view the code
::: details Click me to toggle the code
```js
console.log('Hello, VitePress!')
```
Expand All @@ -200,7 +200,7 @@ console.log('Hello, VitePress!')
Danger zone, do not proceed
:::

::: details Click me to view the code
::: details Click me to toggle the code
```js
console.log('Hello, VitePress!')
```
Expand All @@ -225,6 +225,28 @@ export default defineConfig({
})
```

### Additional Attributes

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:

**Input**

````md
::: details Click me to toggle the code {open}
```js
console.log('Hello, VitePress!')
```
:::
````

**Output**

::: details Click me to toggle the code {open}
```js
console.log('Hello, VitePress!')
```
:::

### `raw`

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.
Expand Down

0 comments on commit 0db71ae

Please sign in to comment.