VSCode Markdown preview enhanced 配置中文字体, 自定义css的方法
在 Ctrl + Shift + P 命令菜单中选择 Customize CSS
这是我基于Solarized Light的配置文件
注意,只需要在系统中(我的是Win10)安装思源宋体 CN Medium,在系统的字体当中找到它对应的名字即可
/* Please visit the URL below for more information: */
/* https://shd101wyy.github.io/markdown-preview-enhanced/#/customize-css */
// modify your style here
// eg: background-color: blue;
html body {
font-family: Georgia, "思源宋体 CN Medium", "Times New Roman", Arial, freesans,
sans-serif;
font-size: 17px;
font-weight: normal;
line-height: 1.6;
color: #1e2427;
/*background-color: #fdf6e3;*/
background-color: #ffffff;
overflow: initial;
box-sizing: border-box;
word-wrap: break-word;
}
html body > :first-child {
margin-top: 0;
}
html body h1,
html body h2,
html body h3,
html body h4,
html body h5,
html body h6 {
line-height: 1.2;
margin-top: 1em;
margin-bottom: 16px;
color: #1e2427;
}
html body h1 {
font-size: 2em;
text-align: center;
font-weight: 300;
padding-bottom: 0.3em;
}
html body h2 {
font-size: 1.75em;
font-weight: 400;
/*padding-bottom: .3em;*/
border-bottom: 1px solid #bfbfbf;
text-align: center;
}
html body h3 {
font-size: 1.5em;
font-weight: 500;
border-bottom: 1px solid #bfbfbf;
}
html body h4 {
font-size: 1.25em;
font-weight: 600;
}
html body h5 {
font-size: 1.1em;
font-weight: 600;
}
html body h6 {
font-size: 1em;
font-weight: 600;
}
html body h1,
html body h2,
html body h3,
html body h4,
html body h5 {
font-weight: 600;
}
html body h5 {
font-size: 1em;
}
html body h6 {
color: #90a3a9;
}
html body strong {
color: #1e2427;
}
html body del {
color: #90a3a9;
}
html body a:not([href]) {
color: inherit;
text-decoration: none;
}
html body a {
color: #08c;
text-decoration: none;
}
html body a:hover {
color: #00a3f5;
text-decoration: none;
}
html body img {
max-width: 100%;
}
html body > p {
margin-top: 0;
margin-bottom: 16px;
word-wrap: break-word;
}
html body > ul,
html body > ol {
margin-bottom: 16px;
}
html body ul,
html body ol {
padding-left: 2em;
}
html body ul.no-list,
html body ol.no-list {
padding: 0;
list-style-type: none;
}
html body ul ul,
html body ul ol,
html body ol ol,
html body ol ul {
margin-top: 0;
margin-bottom: 0;
}
html body li {
margin-bottom: 0;
}
html body li.task-list-item {
list-style: none;
}
html body li > p {
margin-top: 0;
margin-bottom: 0;
}
html body .task-list-item-checkbox {
margin: 0 0.2em 0.25em -1.8em;
vertical-align: middle;
}
html body .task-list-item-checkbox:hover {
cursor: pointer;
}
html body blockquote {
margin: 16px 0;
font-size: inherit;
padding: 0 15px;
color: #90a3a9;
background-color: #fbedc6;
border-left: 4px solid #f8de97;
}
html body blockquote > :first-child {
margin-top: 0;
}
html body blockquote > :last-child {
margin-bottom: 0;
}
html body hr {
height: 4px;
margin: 32px 0;
background-color: #f8de97;
border: 0 none;
}
html body table {
margin: 10px 0 15px 0;
border-collapse: collapse;
border-spacing: 0;
display: block;
width: 100%;
overflow: auto;
word-break: normal;
word-break: keep-all;
}
html body table th {
font-weight: bold;
color: #1e2427;
}
html body table td,
html body table th {
border: 1px solid #f8de97;
padding: 6px 13px;
}
html body dl {
padding: 0;
}
html body dl dt {
padding: 0;
margin-top: 16px;
font-size: 1em;
font-style: italic;
font-weight: bold;
}
html body dl dd {
padding: 0 16px;
margin-bottom: 16px;
}
html body code {
font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
font-size: 0.85em !important;
color: #1e2427;
background-color: #fbedc6;
border-radius: 3px;
padding: 0.2em 0;
}
html body code::before,
html body code::after {
letter-spacing: -0.2em;
content: "\00a0";
}
html body pre > code {
padding: 0;
margin: 0;
font-size: 0.85em !important;
word-break: normal;
white-space: pre;
background: transparent;
border: 0;
}
html body .highlight {
margin-bottom: 16px;
}
html body .highlight pre,
html body pre {
padding: 1em;
overflow: auto;
font-size: 0.85em !important;
line-height: 1.45;
border: #f8de97;
border-radius: 3px;
}
html body .highlight pre {
margin-bottom: 0;
word-break: normal;
}
html body pre code,
html body pre tt {
display: inline;
max-width: initial;
padding: 0;
margin: 0;
overflow: initial;
line-height: inherit;
word-wrap: normal;
background-color: transparent;
border: 0;
}
html body pre code:before,
html body pre tt:before,
html body pre code:after,
html body pre tt:after {
content: normal;
}
html body p,
html body blockquote,
html body ul,
html body ol,
html body dl,
html body pre {
margin-top: 0;
margin-bottom: 16px;
}
html body kbd {
color: #1e2427;
border: 1px solid #f8de97;
border-bottom: 2px solid #f6d47a;
padding: 2px 4px;
background-color: #fbedc6;
border-radius: 3px;
}
@media print {
html body {
/*background-color: #fdf6e3;*/
background-color: #ffffff;
}
html body h1,
html body h2,
html body h3,
html body h4,
html body h5,
html body h6 {
color: #1e2427;
page-break-after: avoid;
}
html body blockquote {
color: #90a3a9;
}
html body pre {
page-break-inside: avoid;
}
html body table {
display: table;
}
html body img {
display: block;
max-width: 100%;
max-height: 100%;
}
html body pre,
html body code {
word-wrap: break-word;
white-space: pre;
}
}
本博文本意在于记录个人的思考与经验,部分博文采用英语写作,可能影响可读性,请见谅
本文来自博客园,作者:ZXYFrank,转载请注明原文链接:https://www.cnblogs.com/zxyfrank/p/17129286.html