新增:新增 Markdown 脚注、Markdown 公式支持
This commit is contained in:
@@ -16,6 +16,103 @@ export default withMermaid(
|
||||
|
||||
head, // <head>内标签配置
|
||||
markdown: markdown, // Markdown配置
|
||||
vue: {
|
||||
template: {
|
||||
compilerOptions: {
|
||||
isCustomElement: (tag) => customElements.includes(tag),
|
||||
},
|
||||
},
|
||||
},
|
||||
themeConfig, // 主题配置
|
||||
}),
|
||||
);
|
||||
);
|
||||
|
||||
const customElements = [
|
||||
'mjx-container',
|
||||
'mjx-assistive-mml',
|
||||
'math',
|
||||
'maction',
|
||||
'maligngroup',
|
||||
'malignmark',
|
||||
'menclose',
|
||||
'merror',
|
||||
'mfenced',
|
||||
'mfrac',
|
||||
'mi',
|
||||
'mlongdiv',
|
||||
'mmultiscripts',
|
||||
'mn',
|
||||
'mo',
|
||||
'mover',
|
||||
'mpadded',
|
||||
'mphantom',
|
||||
'mroot',
|
||||
'mrow',
|
||||
'ms',
|
||||
'mscarries',
|
||||
'mscarry',
|
||||
'mscarries',
|
||||
'msgroup',
|
||||
'mstack',
|
||||
'mlongdiv',
|
||||
'msline',
|
||||
'mstack',
|
||||
'mspace',
|
||||
'msqrt',
|
||||
'msrow',
|
||||
'mstack',
|
||||
'mstack',
|
||||
'mstyle',
|
||||
'msub',
|
||||
'msup',
|
||||
'msubsup',
|
||||
'mtable',
|
||||
'mtd',
|
||||
'mtext',
|
||||
'mtr',
|
||||
'munder',
|
||||
'munderover',
|
||||
'semantics',
|
||||
'math',
|
||||
'mi',
|
||||
'mn',
|
||||
'mo',
|
||||
'ms',
|
||||
'mspace',
|
||||
'mtext',
|
||||
'menclose',
|
||||
'merror',
|
||||
'mfenced',
|
||||
'mfrac',
|
||||
'mpadded',
|
||||
'mphantom',
|
||||
'mroot',
|
||||
'mrow',
|
||||
'msqrt',
|
||||
'mstyle',
|
||||
'mmultiscripts',
|
||||
'mover',
|
||||
'mprescripts',
|
||||
'msub',
|
||||
'msubsup',
|
||||
'msup',
|
||||
'munder',
|
||||
'munderover',
|
||||
'none',
|
||||
'maligngroup',
|
||||
'malignmark',
|
||||
'mtable',
|
||||
'mtd',
|
||||
'mtr',
|
||||
'mlongdiv',
|
||||
'mscarries',
|
||||
'mscarry',
|
||||
'msgroup',
|
||||
'msline',
|
||||
'msrow',
|
||||
'mstack',
|
||||
'maction',
|
||||
'semantics',
|
||||
'annotation',
|
||||
'annotation-xml',
|
||||
];
|
@@ -1,4 +1,6 @@
|
||||
import type { MarkdownOptions } from 'vitepress';
|
||||
import mathjax3 from 'markdown-it-mathjax3';
|
||||
import footnote from 'markdown-it-footnote';
|
||||
|
||||
export const markdown: MarkdownOptions = {
|
||||
// Shiki主题, 所有主题参见: https://github.com/shikijs/shiki/blob/main/docs/themes.md
|
||||
@@ -8,12 +10,15 @@ export const markdown: MarkdownOptions = {
|
||||
},
|
||||
// lineNumbers: true, // 启用行号
|
||||
|
||||
// 在所有文档的<h1>标签后添加<ArticleMetadata/>组件
|
||||
config: (md) => {
|
||||
md.use(mathjax3);
|
||||
md.use(footnote);
|
||||
|
||||
// 在所有文档的<h1>标签后添加<ArticleMetadata/>组件
|
||||
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;
|
||||
}
|
||||
},
|
||||
};
|
||||
};
|
||||
|
@@ -52,3 +52,13 @@ pre, code, kbd, samp {
|
||||
::-webkit-scrollbar-track {
|
||||
background: var(--vp-button-alt-bg);
|
||||
}
|
||||
|
||||
/* mathjax3.css */
|
||||
mjx-container {
|
||||
display: inline-block;
|
||||
margin: auto 2px -2px;
|
||||
}
|
||||
|
||||
mjx-container > svg {
|
||||
margin: auto;
|
||||
}
|
Reference in New Issue
Block a user