vs code 是一款轻量级文档编辑工具, 常用来编写代码和md文档.
1.显示效果
2.安装步骤
第1步: 安装Markdown Preview Enhanced插件
在vs code的商店中, 搜索 Markdown Preview Enhanced, 然后点击安装即可
第2步: 修改插件的默认CSS样式文件
文件名称: katex.min.css
文件路径:
C:甥敳獲自己用户名.vscodeextensionsshd101wyy.markdown-preview-enhanced-0.5.3ode_modules@shd101wyymumedependencieskatex
CSS文件内容
/** initialize css counter */.markdown-preview { counter-reset: h1;}h1 { counter-reset: h2;}h2 { counter-reset: h3;}h3 { counter-reset: h4;}h4 { counter-reset: h5}h5 { counter-reset: h6}/** put counter result into headings */.markdown-preview h1:before { counter-increment: h1; content: counter(h1) ". "}.markdown-preview h2:before { counter-increment: h2; content: counter(h1) "." counter(h2) ". "}/** override the default style for focused headings */.markdown-preview h3:before,h3.md-focus.md-heading:before { counter-increment: h3; content: counter(h1) "." counter(h2) "." counter(h3) ". "}.markdown-preview h4:before,h4.md-focus.md-heading:before { counter-increment: h4; content: counter(h1) "." counter(h2) "." counter(h3) "." counter(h4) ". "}.markdown-preview h5:before,h5.md-focus.md-heading:before { counter-increment: h5; content: counter(h1) "." counter(h2) "." counter(h3) "." counter(h4) "." counter(h5) ". "}.markdown-preview h6:before,h6.md-focus.md-heading:before { counter-increment: h6; content: counter(h1) "." counter(h2) "." counter(h3) "." counter(h4) "." counter(h5) "." counter(h6) "."}/** override the default style for focused headings */.markdown-preview>h3.md-focus:before,.markdown-preview>h4.md-focus:before,.markdown-preview>h5.md-focus:before,.markdown-preview>h6.md-focus:before,h3.md-focus:before,h4.md-focus:before,h5.md-focus:before,h6.md-focus:before { color: inherit; border: inherit; border-radius: inherit; position: inherit; left: initial; float: none; top: initial; font-size: inherit; padding-left: inherit; padding-right: inherit; vertical-align: inherit; font-weight: inherit; line-height: inherit;}
第3步: 使用插件预览
在vs Code中创建一个MD文件如下图, 然后点击右上角的预览按钮.