2018-02-20 18:00:08 +08:00
|
|
|
/*
|
2019-10-08 09:57:05 +08:00
|
|
|
* Based on Plugin: Syntax Highlighter CB
|
2018-02-20 18:00:08 +08:00
|
|
|
* Plugin URI: http://wp.tutsplus.com/tutorials/plugins/adding-a-syntax-highlighter-shortcode-using-prism-js
|
2019-10-08 09:57:05 +08:00
|
|
|
* Description: Highlight your code snippets with an easy to use shortcode based on Lea Verou's Prism.js.
|
|
|
|
* Version: 1.0.0
|
|
|
|
* Author: c.bavota
|
2018-02-20 18:00:08 +08:00
|
|
|
* Author URI: http://bavotasan.comhttp://wp.tutsplus.com/tutorials/plugins/adding-a-syntax-highlighter-shortcode-using-prism-js/ */
|
|
|
|
/* http://cbavota.bitbucket.org/syntax-highlighter/ */
|
|
|
|
|
2019-10-08 09:57:05 +08:00
|
|
|
/* ===== ===== */
|
2018-02-20 18:00:08 +08:00
|
|
|
code[class*="language-"],
|
|
|
|
pre[class*="language-"] {
|
|
|
|
color: #fff;
|
|
|
|
text-shadow: 0 1px 1px #000;
|
|
|
|
font-family: Menlo, Monaco, "Courier New", monospace;
|
|
|
|
direction: ltr;
|
|
|
|
text-align: left;
|
|
|
|
word-spacing: normal;
|
|
|
|
white-space: pre;
|
|
|
|
word-wrap: normal;
|
|
|
|
line-height: 1.4;
|
|
|
|
background: none;
|
|
|
|
border: 0;
|
|
|
|
|
|
|
|
-moz-tab-size: 4;
|
|
|
|
-o-tab-size: 4;
|
|
|
|
tab-size: 4;
|
|
|
|
|
|
|
|
-webkit-hyphens: none;
|
|
|
|
-moz-hyphens: none;
|
|
|
|
-ms-hyphens: none;
|
|
|
|
hyphens: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
pre[class*="language-"] code {
|
2019-10-08 09:57:05 +08:00
|
|
|
float: left;
|
|
|
|
padding: 0 15px 0 0;
|
2018-02-20 18:00:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
pre[class*="language-"],
|
|
|
|
:not(pre) > code[class*="language-"] {
|
|
|
|
background: #222;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Code blocks */
|
|
|
|
pre[class*="language-"] {
|
|
|
|
padding: 15px;
|
|
|
|
margin: 1em 0;
|
|
|
|
overflow: auto;
|
|
|
|
-moz-border-radius: 8px;
|
|
|
|
-webkit-border-radius: 8px;
|
|
|
|
border-radius: 8px;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Inline code */
|
|
|
|
:not(pre) > code[class*="language-"] {
|
|
|
|
padding: 5px 10px;
|
|
|
|
line-height: 1;
|
|
|
|
-moz-border-radius: 3px;
|
|
|
|
-webkit-border-radius: 3px;
|
|
|
|
border-radius: 3px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.token.comment,
|
|
|
|
.token.prolog,
|
|
|
|
.token.doctype,
|
|
|
|
.token.cdata {
|
|
|
|
color: #797979;
|
|
|
|
}
|
|
|
|
|
|
|
|
.token.selector,
|
|
|
|
.token.operator,
|
|
|
|
.token.punctuation {
|
|
|
|
color: #fff;
|
|
|
|
}
|
|
|
|
|
|
|
|
.token.namespace {
|
|
|
|
opacity: .7;
|
|
|
|
}
|
|
|
|
|
|
|
|
.token.tag,
|
|
|
|
.token.boolean {
|
|
|
|
color: #ffd893;
|
|
|
|
}
|
|
|
|
|
|
|
|
.token.atrule,
|
|
|
|
.token.attr-value,
|
|
|
|
.token.hex,
|
|
|
|
.token.string {
|
|
|
|
color: #B0C975;
|
|
|
|
}
|
|
|
|
|
|
|
|
.token.property,
|
|
|
|
.token.entity,
|
|
|
|
.token.url,
|
|
|
|
.token.attr-name,
|
|
|
|
.token.keyword {
|
|
|
|
color: #c27628;
|
|
|
|
}
|
|
|
|
|
|
|
|
.token.regex {
|
|
|
|
color: #9B71C6;
|
|
|
|
}
|
|
|
|
|
|
|
|
.token.entity {
|
|
|
|
cursor: help;
|
|
|
|
}
|
|
|
|
|
|
|
|
.token.function,
|
|
|
|
.token.constant {
|
|
|
|
color: #e5a638;
|
|
|
|
}
|
|
|
|
|
|
|
|
.token.variable {
|
|
|
|
color: #fdfba8;
|
|
|
|
}
|
|
|
|
|
|
|
|
.token.number {
|
|
|
|
color: #8799B0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.token.important,
|
|
|
|
.token.deliminator {
|
|
|
|
color: #E45734;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Line highlight plugin */
|
|
|
|
pre[data-line] {
|
|
|
|
position: relative;
|
|
|
|
padding: 1em 0 1em 3em;
|
|
|
|
}
|
|
|
|
|
|
|
|
.line-highlight {
|
|
|
|
position: absolute;
|
|
|
|
left: 0;
|
|
|
|
right: 0;
|
|
|
|
margin-top: 1em; /* Same as .prism's padding-top */
|
|
|
|
background: rgba(255,255,255,.2);
|
|
|
|
pointer-events: none;
|
|
|
|
line-height: inherit;
|
|
|
|
white-space: pre;
|
|
|
|
}
|
|
|
|
|
|
|
|
.line-highlight:before,
|
|
|
|
.line-highlight[data-end]:after {
|
2019-10-08 09:57:05 +08:00
|
|
|
content: attr(data-start);
|
|
|
|
position: absolute;
|
|
|
|
top: .3em;
|
|
|
|
left: .6em;
|
|
|
|
min-width: 1em;
|
|
|
|
padding: 0 .5em;
|
|
|
|
background-color: rgba(255,255,255,.3);
|
|
|
|
color: #fff;
|
|
|
|
font: bold 65%/1.5 sans-serif;
|
|
|
|
text-align: center;
|
|
|
|
-moz-border-radius: 8px;
|
|
|
|
-webkit-border-radius: 8px;
|
|
|
|
border-radius: 8px;
|
|
|
|
text-shadow: none;
|
2018-02-20 18:00:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
.line-highlight[data-end]:after {
|
2019-10-08 09:57:05 +08:00
|
|
|
content: attr(data-end);
|
|
|
|
top: auto;
|
|
|
|
bottom: .4em;
|
2018-02-20 18:00:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* for line numbers */
|
|
|
|
.line-numbers-rows {
|
|
|
|
margin: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.line-numbers-rows span {
|
2019-10-08 09:57:05 +08:00
|
|
|
padding-right: 10px;
|
|
|
|
border-right: 3px #d9d336 solid;
|
2018-02-20 18:00:08 +08:00
|
|
|
}
|