|
|
@ -477,7 +477,7 @@ When set to `true`, the production app will be built in [MPA Mode](../guide/mpa-
|
|
|
|
- key: `markdown`
|
|
|
|
- key: `markdown`
|
|
|
|
- Type: `MarkdownOption`
|
|
|
|
- Type: `MarkdownOption`
|
|
|
|
|
|
|
|
|
|
|
|
配置 Markdown 解析器选项。VitePress 使用 [Markdown-it](https://github.com/markdown-it/markdown-it) 作为解析器,使用 [Shiki](https://shiki.matsu.io/) 来高亮不同语言语法。在此选项中,你可以传递各种 Markdown 相关选项以满足你的需要。
|
|
|
|
配置 Markdown 解析器选项。VitePress 使用 [Markdown-it](https://github.com/markdown-it/markdown-it) 作为解析器,使用[Shikiji](https://github.com/antfu/shikiji) ([Shiki](https://shiki.matsu.io/) 的改进版本) 来高亮不同语言语法。在此选项中,你可以传递各种 Markdown 相关选项以满足你的需要。
|
|
|
|
|
|
|
|
|
|
|
|
```js
|
|
|
|
```js
|
|
|
|
export default {
|
|
|
|
export default {
|
|
|
@ -485,87 +485,7 @@ export default {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
以下是你可以在此对象中可配置的所有选项:
|
|
|
|
查看[类型声明和 jsdocs](https://github.com/vuejs/vitepress/blob/main/src/node/markdown/markdown.ts) 以获得所有可配置的选项。
|
|
|
|
|
|
|
|
|
|
|
|
```ts
|
|
|
|
|
|
|
|
interface MarkdownOptions extends MarkdownIt.Options {
|
|
|
|
|
|
|
|
// Custom theme for syntax highlighting.
|
|
|
|
|
|
|
|
// You can use an existing theme.
|
|
|
|
|
|
|
|
// See: https://github.com/shikijs/shiki/blob/main/docs/themes.md#all-themes
|
|
|
|
|
|
|
|
// Or add your own theme.
|
|
|
|
|
|
|
|
// See: https://github.com/shikijs/shiki/blob/main/docs/themes.md#loading-theme
|
|
|
|
|
|
|
|
theme?:
|
|
|
|
|
|
|
|
| Shiki.IThemeRegistration
|
|
|
|
|
|
|
|
| { light: Shiki.IThemeRegistration; dark: Shiki.IThemeRegistration }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Enable line numbers in code block.
|
|
|
|
|
|
|
|
lineNumbers?: boolean
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Add support for your own languages.
|
|
|
|
|
|
|
|
// https://github.com/shikijs/shiki/blob/main/docs/languages.md#supporting-your-own-languages-with-shiki
|
|
|
|
|
|
|
|
languages?: Shiki.ILanguageRegistration[]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// markdown-it-anchor plugin options.
|
|
|
|
|
|
|
|
// See: https://github.com/valeriangalliat/markdown-it-anchor#usage
|
|
|
|
|
|
|
|
anchor?: anchorPlugin.AnchorOptions
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// markdown-it-attrs plugin options.
|
|
|
|
|
|
|
|
// See: https://github.com/arve0/markdown-it-attrs
|
|
|
|
|
|
|
|
attrs?: {
|
|
|
|
|
|
|
|
leftDelimiter?: string
|
|
|
|
|
|
|
|
rightDelimiter?: string
|
|
|
|
|
|
|
|
allowedAttributes?: Array<string | RegExp>
|
|
|
|
|
|
|
|
disable?: boolean
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// specify default language for syntax highlighter
|
|
|
|
|
|
|
|
defaultHighlightLang?: string
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// @mdit-vue/plugin-frontmatter plugin options.
|
|
|
|
|
|
|
|
// See: https://github.com/mdit-vue/mdit-vue/tree/main/packages/plugin-frontmatter#options
|
|
|
|
|
|
|
|
frontmatter?: FrontmatterPluginOptions
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// @mdit-vue/plugin-headers plugin options.
|
|
|
|
|
|
|
|
// See: https://github.com/mdit-vue/mdit-vue/tree/main/packages/plugin-headers#options
|
|
|
|
|
|
|
|
headers?: HeadersPluginOptions | boolean
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// @mdit-vue/plugin-sfc plugin options.
|
|
|
|
|
|
|
|
// See: https://github.com/mdit-vue/mdit-vue/tree/main/packages/plugin-sfc#options
|
|
|
|
|
|
|
|
sfc?: SfcPluginOptions
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// @mdit-vue/plugin-toc plugin options.
|
|
|
|
|
|
|
|
// See: https://github.com/mdit-vue/mdit-vue/tree/main/packages/plugin-toc#options
|
|
|
|
|
|
|
|
toc?: TocPluginOptions
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// @mdit-vue/plugin-component plugin options.
|
|
|
|
|
|
|
|
// See: https://github.com/mdit-vue/mdit-vue/tree/main/packages/plugin-component#options
|
|
|
|
|
|
|
|
component?: ComponentPluginOptions
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Configure the Markdown-it instance.
|
|
|
|
|
|
|
|
config?: (md: MarkdownIt) => void
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Same as `config` but will be applied before all other plugins.
|
|
|
|
|
|
|
|
preConfig?: (md: MarkdownIt) => void
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Disable cache (experimental)
|
|
|
|
|
|
|
|
cache?: boolean
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Math support (experimental)
|
|
|
|
|
|
|
|
// You need to install `markdown-it-mathjax3` and set `math` to `true` to enable it.
|
|
|
|
|
|
|
|
// You can also pass options to `markdown-it-mathjax3` here.
|
|
|
|
|
|
|
|
// See: https://github.com/tani/markdown-it-mathjax3#customization
|
|
|
|
|
|
|
|
math?: boolean | any
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Global custom container titles
|
|
|
|
|
|
|
|
container?: {
|
|
|
|
|
|
|
|
infoLabel?: string
|
|
|
|
|
|
|
|
tipLabel?: string
|
|
|
|
|
|
|
|
warningLabel?: string
|
|
|
|
|
|
|
|
dangerLabel?: string
|
|
|
|
|
|
|
|
detailsLabel?: string
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### vite
|
|
|
|
### vite
|
|
|
|
|
|
|
|
|
|
|
|