markdown-hint
向你的 VuePress 站点添加 GFM 警告和提示容器。
该插件已经集成到默认主题中。
使用方法
npm i -D @vuepress/plugin-markdown-hint@nextimport { markdownHintPlugin } from '@vuepress/plugin-markdown-hint'
export default {
plugins: [
markdownHintPlugin({
// 启用提示容器,默认启用
hint: true,
// 启用 GFM 警告
alert: true,
}),
],
}指南
默认情况下,我们支持 important、info、note、tip、warning、caution、details 容器与 markdown 容器:
Demo
::: tip
一个带有 `code` 和[链接](https://example.com)的自定义提示容器。
```js
const a = 1
```
:::要自定义容器的标题,你可以在命名容器后添加标题:
自定义标题
一个带有自定义标题的重要容器。
Demo
::: important 自定义标题
一个带有自定义标题的重要容器。
:::容器可以只包含一个标题:
仅有标题
Demo
::: warning 仅有标题
:::插件也提供了 alert 选项,以支持 GFM 警告:
> [!note]
> This is note text
> [!important]
> This is important text
> [!tip]
> This is tip text
> [!warning]
> This is warning text
> [!caution]
> This is caution text选项
hint
boolean默认值
true是否启用提示容器,包括 important、info、note、tip、warning、caution、details。
alert
boolean是否启用 GFM 警告支持。
injectStyles
boolean默认值
true是否注入默认样式。
locales
MarkdownHintPluginLocaleConfig提示容器标题的本地化配置。
参考:多语言配置。
locales.<localePath>.important
string重要块的默认标题。
locales.<localePath>.note
string注释块的默认标题。
locales.<localePath>.tip
string提示块的默认标题。
locales.<localePath>.warning
string注意块的默认标题。
locales.<localePath>.caution
string警告块的默认标题。
locales.<localePath>.info
string信息块的默认标题。
locales.<localePath>.details
string详情块的默认标题。
