# 博客搭建
# vuepress 安装 markdown-it-katex 插件
yarn add markdown-it-katex
1
katex 需要引用css文件和js文件,官方文档:https://katex.org/docs/browser.html
vueprss 配置文件,需要添加一下代码即可:
head: [
['link', {
rel: 'stylesheet',
href: 'https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.7.1/katex.min.css'
}],
['link', {
rel: "stylesheet",
href: "https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/2.10.0/github-markdown.min.css"
}],
]
markdown: {
// 代码块函数显示
lineNumbers: true,
extendMarkdown: md => {
md.set({
html: true
})
md.use(require('markdown-it-katex'))
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21