docs(md): global custom container titles (#3112)

Co-authored-by: Divyansh Singh <40380293+brc-dd@users.noreply.github.com>
pull/3114/head
Jason Dai 1 year ago committed by GitHub
parent 62f0e4f109
commit a13f5cb3a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -206,6 +206,25 @@ console.log('Hello, VitePress!')
``` ```
::: :::
Also, you may set custom titles globally by adding the following content in site config, helpful if not writing in English:
```ts
// config.ts
export default defineConfig({
// ...
markdown: {
container: {
tipLabel: '提示',
warningLabel: '警告',
dangerLabel: '危险',
infoLabel: '信息',
detailsLabel: '详细信息'
}
}
// ...
})
```
### `raw` ### `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. 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.
@ -230,11 +249,9 @@ Wraps in a <div class="vp-raw">
```js ```js
import { postcssIsolateStyles } from 'vitepress' import { postcssIsolateStyles } from 'vitepress'
export default { export default {
plugins: [ plugins: [postcssIsolateStyles()]
postcssIsolateStyles()
]
} }
``` ```
@ -548,7 +565,7 @@ const line3 = 'This is line 3'
// line-numbers is enabled and start from 2 // line-numbers is enabled and start from 2
const line3 = 'This is line 3' const line3 = 'This is line 3'
const line4 = 'This is line 4' const line4 = 'This is line 4'
```` ```
## Import Code Snippets ## Import Code Snippets

@ -532,6 +532,15 @@ interface MarkdownOptions extends MarkdownIt.Options {
// You can also pass options to `markdown-it-mathjax3` here. // You can also pass options to `markdown-it-mathjax3` here.
// See: https://github.com/tani/markdown-it-mathjax3#customization // See: https://github.com/tani/markdown-it-mathjax3#customization
math?: any math?: any
// Global custom container titles
container?: {
infoLabel?: string
tipLabel?: string
warningLabel?: string
dangerLabel?: string
detailsLabel?: string
}
} }
``` ```

Loading…
Cancel
Save