first commit

This commit is contained in:
neo 2019-11-15 00:09:40 +08:00
commit 9628d1b208
4 changed files with 236 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/.idea/

5
README.md Normal file
View File

@ -0,0 +1,5 @@
# WordPress 代码高亮 Mac 样式 by highlight.js
- 基于highlight.js
- mac风格
- 支持复制

14
highlight-worker.js Normal file
View File

@ -0,0 +1,14 @@
/*!
* WordPress highlight
* https://github.com/ineo6/wordpress-highlight
*/
importScripts('https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@9.16.2/build/highlight.min.js');
onmessage = function (event) {
var data = JSON.parse(event.data);
var result = self.hljs.highlightAuto(data.code);
postMessage(JSON.stringify({result: result.value, index: data.index}));
};

216
mac-style.css Normal file
View File

@ -0,0 +1,216 @@
/*!
* WordPress highlight
* https://github.com/ineo6/wordpress-highlight
*/
/*highlight mac风格*/
.highlight-wrap:before {
content: " ";
position: absolute;
-webkit-border-radius: 50%;
border-radius: 50%;
background: #fc625d;
width: 12px;
height: 12px;
left: 12px;
margin-top: -18px;
-webkit-box-shadow: 20px 0 #fdbc40, 40px 0 #35cd4b;
box-shadow: 20px 0 #fdbc40, 40px 0 #35cd4b;
z-index: 2
}
pre.highlight-wrap {
position: relative;
background: #21252b;
border-radius: 5px;
font: 15px/22px "Microsoft YaHei", Arial, Sans-Serif;
line-height: 1.6;
margin: 0;
margin-bottom: 24px;
max-width: 100%;
overflow: auto;
text-shadow: none;
color: #000;
padding-top: 30px;
box-shadow: 0 10px 30px 0 rgba(0, 0, 0, .4)
}
.highlight-wrap code::-webkit-scrollbar {
height: 10px !important;
width: 10px !important;
background-color: #1d1f21 !important
}
.highlight-wrap code::-webkit-scrollbar-track {
-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, .3) !important;
border-radius: 10px !important;
background-color: #21252b !important
}
.highlight-wrap code::-webkit-scrollbar-thumb {
border-radius: 5px !important;
-webkit-box-shadow: none;
background-color: #4d4d4d !important
}
pre.highlight-wrap code {
background: #1d1f21;
color: #fff;
word-break: break-word;
font-family: 'Source Code Pro', monospace, Helvetica, Tahoma, Arial, STXihei, "STHeiti Light", "Microsoft YaHei", sans-serif;
padding: 2px;
text-shadow: none;
border-radius: 0 0 5px 5px;
}
.highlight-wrap code[data-rel]:before {
color: #fff;
content: attr(data-rel);
height: 30px;
line-height: 30px;
background: #21252b;
font-size: 16px;
position: absolute;
margin-top: -30px;
left: 0;
width: 100%;
font-family: Ubuntu, sans-serif;
font-weight: 700;
padding: 0 80px;
text-indent: 15px;
text-align: center;
float: left;
z-index: 1;
border-radius: 5px 5px 0 0;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
pointer-events: none
}
.hljs, .highlight-wrap > code {
display: block;
overflow-x: auto;
padding: .5em;
color: #abb2bf;
background: rgba(254, 250, 199, .5);
border-radius: 10px
}
.copy-code {
color: #fff;
position: absolute;
float: right;
right: 10px;
top: 0;
padding-top: 4px;
padding-right: 2px;
z-index: 2;
font-size: 15px;
cursor: pointer;
}
.hljs-comment,
.hljs-quote {
color: #888f96;
font-style: italic
}
.hljs-doctag,
.hljs-formula,
.hljs-keyword {
color: #c678dd
}
.hljs-deletion,
.hljs-name,
.hljs-section,
.hljs-selector-tag,
.hljs-subst {
color: #e06c75
}
.hljs-literal {
color: #56b6c2
}
.hljs-addition,
.hljs-attribute,
.hljs-meta-string,
.hljs-regexp,
.hljs-string {
color: #98c379
}
.hljs-built_in,
.hljs-class .hljs-title {
color: #e6c07b
}
.hljs-attr,
.hljs-number,
.hljs-selector-attr,
.hljs-selector-class,
.hljs-selector-pseudo,
.hljs-template-variable,
.hljs-type,
.hljs-variable {
color: #d19a66
}
.hljs-bullet,
.hljs-link,
.hljs-meta,
.hljs-selector-id,
.hljs-symbol,
.hljs-title {
color: #61aeee
}
.hljs-emphasis {
font-style: italic
}
.hljs-strong {
font-weight: 700
}
.hljs-link {
text-decoration: underline
}
.hljs-ln {
margin: 6px 0 0 0 !important
}
table.hljs-ln,
.hljs-ln td {
border: none;
}
td.hljs-ln-numbers {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
text-align: center;
color: #888f96;
background: #1d1f21;
font-family: 'Source Code Pro', monospace, Helvetica, Tahoma, Arial, STXihei, "STHeiti Light", "Microsoft YaHei", sans-serif;
vertical-align: top;
position: absolute;
left: 0;
width: 30px
}
/* for block of code */
.hljs-ln-code {
padding-left: 30px !important;
}
.hljs-ln-code .hljs-ln-line:hover {
background-color: rgba(255, 255, 255, .1)
}