之前一直用My Syntax Highlighter插件设置文章内代码块,但是近几次博客系统升级后,这个插件自动高度和行号之类的设置无法再生效,可能是古腾堡编辑器新做了什么限制?在插件市场里逛了一圈后打算使用古腾堡编辑器自带的代码区块,新加个Code Syntax Block插件用于美化代码块,Code Syntax Block自带的风格有点少,于是参考monokai theme根据自己的喜好调了下它的配置CSS文件。在这里留个记录以防插件更新自定义文件被覆盖掉~
#f92772 | 249,39,114
#fe9720 | 254,151,32
#e6da74 | 230,218,116
#a7e22e | 167,226,46
#66d9ee | 102,217,238
#ae81ff | 174,129,255
#808080 | 128,128,128
#74715e | 116,113,94
#f6f6f6 | 246,246,246
pre.wp-block-code code {
color: #f8f8f2;
padding-left: 0;
overflow-x: initial;
}
code[class*="language-"],
pre[class*="language-"] {
color: #f8f8f2;
background: none;
font-family: Hack, "Fira Code", Consolas, Menlo, Monaco, "Andale Mono", "Lucida Console", "Lucida Sans Typewriter", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Liberation Mono", "Nimbus Mono L", "Courier New", Courier, monospace;
text-align: left;
white-space: pre;
word-spacing: normal;
word-break: normal;
word-wrap: normal;
line-height: 1.5;
-moz-tab-size: 4;
-o-tab-size: 4;
tab-size: 4;
-webkit-hyphens: none;
-moz-hyphens: none;
-ms-hyphens: none;
hyphens: none;
}
/* 背景色2b2b2b */
pre.wp-block-code {
background: #272822;
padding: 1em;
margin: 0.5em auto;
overflow: auto;
border-radius: 0.3em;
}
/* 注释、文件头 */
.token.comment{
color: #75715E;
}
.token.prolog,
.token.doctype,
.token.cdata {
color: #F8F8F2;
}
/* 括号双引号f92772#F8F8F2 */
.token.punctuation {
color: #f92772;
}
/* 关键词 */
.token.property{
color: #a7e22e;
}
.token.tag,
.token.constant,
.token.symbol,
.token.deleted {
color: #F92772;
}
/* 数字 */
.token.boolean,
.token.number {
color: #ae81ff;
}
/* 引号内字符串#e6da74 */
.token.attr-name{
color: #a7e22e;
}
.token.string,
.token.char,
.token.builtin,
.token.inserted {
color: #e6da74;
}
/* css选择 */
.token.selector{
color: #66d9ee;
}
/* 等号 */
.token.operator{
color: #F8F8F2;
}
/* 括号内数值 */
.token.entity,
.token.url,
.language-css .token.string,
.token.language-javascript .token.string,
.style .token.string,
.token.variable {
color: #ae81ff;
}
/* @标注 */
.token.attr-value,
.token.atrule{
color: #e6da74;
}
.token.function {
color: #fe9720;
}
/* 关键词f92772 */
.token.keyword {
color: #66d9ee;
}
.token.regex,
.token.important {
color: #ffd700;
}
.token.important,
.token.bold {
font-weight: bold;
}
.token.italic {
font-style: italic;
}
.token.entity {
cursor: help;
}
@media screen and (-ms-high-contrast: active) {
code[class*="language-"],
pre[class*="language-"] {
color: windowText;
background: window;
}
:not(pre) > code[class*="language-"],
pre[class*="language-"] {
background: window;
}
.token.important {
background: highlight;
color: window;
font-weight: normal;
}
.token.atrule,
.token.attr-value,
.token.function,
.token.keyword,
.token.operator,
.token.selector {
font-weight: bold;
}
.token.attr-value,
.token.comment,
.token.doctype,
.token.function,
.token.keyword,
.token.operator,
.token.property,
.token.string {
color: highlight;
}
.token.attr-value,
.token.url {
font-weight: normal;
}
}
pre.line-numbers {
position: relative;
padding-left: 3.8em;
counter-reset: linenumber;
}
pre.line-numbers > code {
position: relative;
}
.line-numbers .line-numbers-rows {
position: absolute;
pointer-events: none;
top: 0;
font-size: 100%;
left: -3.8em;
width: 3em; /* works for line-numbers below 1000 lines */
letter-spacing: -1px;
border-right: 0;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.line-numbers-rows > span {
pointer-events: none;
display: block;
counter-increment: linenumber;
}
.line-numbers-rows > span:before {
content: counter(linenumber);
color: #5C6370;
display: block;
padding-right: 0.8em;
text-align: right;
}
.prism-titlename {
margin: -14px -12px 24px -12px;
padding: 4px 16px;
font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;
font-weight: bold;
color: orange;
background-color: #444;
}
发表评论