Merge pull request #1479 from ant-design/refactor-highlight

site: replace highlight.js with Prism.js
This commit is contained in:
yiminghe 2016-04-21 21:12:46 -07:00
commit bcbecca040
5 changed files with 145 additions and 59 deletions

View File

@ -71,7 +71,7 @@
"warning": "~2.1.0"
},
"devDependencies": {
"antd-md-loader": "~0.5.0",
"antd-md-loader": "~0.7.0",
"atool-build": "^0.6.5",
"babel-cli": "^6.2.0",
"babel-core": "^6.2.1",

View File

@ -1,5 +1,5 @@
import 'antd/style/index.less';
import './styles/tomorrow.less';
import './styles/highlight.less';
import './styles/common.less';
import './styles/markdown.less';
import './styles/toc.less';

View File

@ -0,0 +1,142 @@
/**
* prism.js default theme for JavaScript, CSS and HTML
* Based on dabblet (http://dabblet.com)
* @author Lea Verou
*/
code[class*="language-"],
pre[class*="language-"] {
color: black;
background: none;
text-shadow: 0 1px white;
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
direction: ltr;
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;
}
pre[class*="language-"]::-moz-selection,
pre[class*="language-"] ::-moz-selection,
code[class*="language-"]::-moz-selection,
code[class*="language-"] ::-moz-selection {
text-shadow: none;
background: #b3d4fc;
}
pre[class*="language-"]::selection,
pre[class*="language-"] ::selection,
code[class*="language-"]::selection,
code[class*="language-"] ::selection {
text-shadow: none;
background: #b3d4fc;
}
@media print {
code[class*="language-"],
pre[class*="language-"] {
text-shadow: none;
}
}
/* Code blocks */
pre[class*="language-"] {
padding: 1em;
margin: .5em 0;
overflow: auto;
}
:not(pre) > code[class*="language-"],
pre[class*="language-"] {
background: #f5f2f0;
}
/* Inline code */
:not(pre) > code[class*="language-"] {
padding: .1em;
border-radius: .3em;
white-space: normal;
}
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
color: slategray;
}
.token.punctuation {
color: #999;
}
.namespace {
opacity: .7;
}
.token.property,
.token.tag,
.token.boolean,
.token.number,
.token.constant,
.token.symbol,
.token.deleted {
color: #905;
}
.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted {
color: #690;
}
.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string {
color: #a67f59;
background: hsla(0, 0%, 100%, .5);
}
.token.atrule,
.token.attr-value,
.token.keyword {
color: #07a;
}
.token.function {
color: #DD4A68;
}
.token.regex,
.token.important,
.token.variable {
color: #e90;
}
.token.important,
.token.bold {
font-weight: bold;
}
.token.italic {
font-style: italic;
}
.token.entity {
cursor: help;
}

View File

@ -89,11 +89,11 @@
.markdown pre {
border-radius: 6px;
background: #f7f7f7;
padding: 1em 2em;
}
.markdown pre code {
border: none;
padding: 1em 2em;
background: #f7f7f7;
margin: 0;
}

View File

@ -1,56 +0,0 @@
/* Tomorrow Theme */
/* http://jmblog.hljs-github.hljs-com/color-themes-for-google-code-highlightjs */
/* Original theme - https://github.hljs-com/chriskempson/tomorrow-theme */
/* http://jmblog.hljs-github.hljs-com/color-themes-for-google-code-highlightjs */
.hljs-tomorrow-comment, pre .hljs-comment {
color: #CCCCCC;
}
.hljs-tomorrow-red, pre .hljs-variable, pre .hljs-attribute, pre .hljs-tag, pre .hljs-regexp, pre .hljs-ruby .hljs-constant, pre .hljs-xml .hljs-tag .hljs-title, pre .hljs-xml .hljs-pi, pre .hljs-xml .hljs-doctype, pre .hljs-html .hljs-doctype, pre .hljs-css .hljs-id, pre .hljs-css .hljs-class, pre .hljs-css .hljs-pseudo {
color: #BB0606;
}
.hljs-tomorrow-orange, pre .hljs-number, pre .hljs-preprocessor, pre .hljs-built_in, pre .hljs-literal, pre .hljs-params, pre .hljs-constant {
color: #FF6600;
}
.hljs-tomorrow-yellow, pre .hljs-class, pre .hljs-ruby .hljs-class .hljs-title, pre .hljs-css .hljs-rules .hljs-attribute {
color: #1D80D3;
}
.hljs-tomorrow-green, pre .hljs-string, pre .hljs-value, pre .hljs-inheritance, pre .hljs-header, pre .hljs-ruby .hljs-symbol, pre .hljs-xml .hljs-cdata {
color: #39A30E;
}
.hljs-tomorrow-aqua, pre .hljs-css .hljs-hexcolor {
color: #01B3CA;
}
.hljs-tomorrow-blue, pre .hljs-function, pre .hljs-python .hljs-decorator, pre .hljs-python .hljs-title, pre .hljs-ruby .hljs-function .hljs-title, pre .hljs-ruby .hljs-title .hljs-keyword, pre .hljs-perl .hljs-sub, pre .hljs-javascript .hljs-title, pre .hljs-coffeescript .hljs-title {
color: #4271ae;
}
.hljs-tomorrow-purple, pre .hljs-keyword, pre .hljs-javascript .hljs-function {
color: #1D80D3;
}
code {
background: #f7f7f7;
padding: 1px 6px;
border-radius: 3px;
color: #888;
font-size: 0.8rem;
border: 1px solid #e9e9e9;
}
pre code {
display: block;
background: white;
color: #666;
line-height: 1.5;
border: 1px solid #e9e9e9;
padding: 10px 15px;
border-radius: 6px;
font-size: 13px;
white-space: pre;
}