This repository has been archived on 2025-06-28. You can view files and clone it, but cannot push or open issues or pull requests.
Files
vitepress-theme-blog-charle…/docs/.vitepress/config/markdown.ts

19 lines
776 B
TypeScript

import type { MarkdownOptions } from 'vitepress';
export const markdown: MarkdownOptions = {
// Shiki主题, 所有主题参见: https://github.com/shikijs/shiki/blob/main/docs/themes.md
theme: {
light: 'github-light',
dark: 'github-dark-dimmed'
},
// lineNumbers: true, // 启用行号
// 在所有文档的<h1>标签后添加<ArticleMetadata/>组件
config: (md) => {
md.renderer.rules.heading_close = (tokens, idx, options, env, slf) => {
let htmlResult = slf.renderToken(tokens, idx, options);
if (tokens[idx].tag === 'h1') htmlResult += `\n<ClientOnly><ArticleMetadata v-if="($frontmatter?.aside ?? true) && ($frontmatter?.showArticleMetadata ?? true)" :article="$frontmatter" /></ClientOnly>`;
return htmlResult;
}
},
};