修复:启用评论组件
This commit is contained in:
15
docs/.vitepress/config/markdown.ts
Normal file
15
docs/.vitepress/config/markdown.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import type { MarkdownOptions } from 'vitepress'
|
||||
|
||||
export const markdown: MarkdownOptions = {
|
||||
theme: 'one-dark-pro', // Shiki主题, 所有主题参见: https://github.com/shikijs/shiki/blob/main/docs/themes.md
|
||||
lineNumbers: true, // 启用行号
|
||||
|
||||
// 在所有文档的<h1>标签后添加<ArticleMetadata/>组件
|
||||
config: (md) => {
|
||||
md.renderer.rules.heading_close = (tokens, idx, options, env, slf) => {
|
||||
let htmlResult = slf.renderToken(tokens, idx, options, env, slf)
|
||||
if (tokens[idx].tag === 'h1') htmlResult += `\n<ArticleMetadata v-if="$frontmatter?.aside ?? true" :article="$frontmatter" />`
|
||||
return htmlResult
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user