Skip to content

Commit 7c3cab2

Browse files
authored
Merge branch 'master' into docs
2 parents 3275614 + c321a4c commit 7c3cab2

File tree

3 files changed

+131
-89
lines changed

3 files changed

+131
-89
lines changed

prettify-variables.less

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/**
2+
* @stylesheet prettify-variables.less Prettify Variables
3+
* @parent bit-docs/theme
4+
*
5+
* @description Variables to customize code highlighting.
6+
*
7+
* @body
8+
*
9+
* Copy these variables into your theme's variables.less to modify.
10+
*/
11+
12+
/**
13+
* @styles color-palette Color Palette
14+
*
15+
* @description
16+
* Variables used to define the site's color palette.
17+
* @iframe demos/color-palette.html 630
18+
*/
19+
@darkSkies: #484848;
20+
@haze: #cccccc;
21+
@fog: #eae9e9;
22+
@clear: #ffffff;
23+
@sunrise: #f7f8c3;
24+
25+
26+
// Variables used to define color on text elements.
27+
28+
@colorCode: @sunrise;
29+
30+
31+
// Variables used to set the color on code syntax.
32+
33+
@str-color: #dd1144;
34+
@kwd-color: #333333;
35+
@com-color: #999988;
36+
@type-color: #445588;
37+
@lit-color: #445588;
38+
@pun-color: #333333;
39+
@opn-color: #333333;
40+
@clo-color: #333333;
41+
@tag-color: #navy;
42+
@atn-color: #teal;
43+
@atv-color: #dd1144;
44+
@dec-color: #333333;
45+
@var-color: #teal;
46+
@fun-color: #990000;
47+
48+
49+
// Variables used to set the color for print or projection.
50+
51+
@str-color-pp: #006600;
52+
@kwd-color-pp: #006;
53+
@com-color-pp: #600;
54+
@typ-color-pp: #404;
55+
@lit-color-pp: #004444;
56+
@pun-color-pp: #444400;
57+
@opn-color-pp: #444400;
58+
@clo-color-pp: #444400;
59+
@tag-color-pp: #006;
60+
@atn-color-pp: #440044;
61+
@atv-color-pp: #006600;

prettify.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ module.exports = function(){
1919
for(var i = 0; i < codes.length; i ++){
2020
var code = codes[i];
2121
if(code.parentNode.nodeName.toUpperCase() === "PRE"){
22-
code.className = code.className +" prettyprint";
22+
code.parentNode.className = code.parentNode.className + " prettyprint";
2323
}
2424
}
2525
//turn off batching (https://github.com/google/code-prettify/blob/master/src/prettify.js#L142)

prettify.less

Lines changed: 69 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
@import "locate://bit-docs-prettify/prettify-variables.less";
2+
3+
// allow user theme to override variables
14
@import "locate://bit-docs-site/styles/variables.less";
25

36
/**
@@ -61,132 +64,127 @@
6164
* ```
6265
*/
6366
code {
64-
background-color: @colorCode;
65-
border-radius: 5px;
6667
padding: 0 5px;
68+
border-radius: 5px;
69+
background-color: @colorCode;
6770
}
71+
6872
pre, code, pre *, code * {
69-
font-family: "Courier New", Courier, mono;
70-
font-style: normal;
7173
font-weight: 300;
74+
font-style: normal;
75+
font-family: "courier new", courier, mono;
7276
}
77+
7378
pre {
74-
background-color: @clear;
75-
border: 1px solid @haze;
79+
overflow: auto;
7680
border-radius: 5px;
77-
margin: 0;
78-
margin-bottom: 20px;
79-
vertical-align: top;
80-
overflow:auto;
8181
padding: 10px 20px;
82+
vertical-align: top;
83+
border: 1px solid @haze;
84+
background-color: @clear;
8285

83-
code{
84-
font-size: 14px;
85-
line-height: 16px;
86-
letter-spacing: 0px;
87-
background-color: transparent;
86+
code {
87+
font-size: 14px;
88+
line-height: 16px;
89+
letter-spacing: 0px;
90+
padding: 0 !important;
91+
background-color: transparent;
8892
}
8993

9094
ol {
91-
margin: 0 0 0 40px;
92-
padding: 0;
93-
94-
li {
95-
text-indent: 0;
96-
color: @darkSkies;
97-
background-color: @clear;
98-
margin: 0;
99-
list-style: decimal;
100-
}
95+
padding: 0;
96+
font-size: 14px;
97+
margin: 0 0 0 40px;
98+
99+
li {
100+
margin: 0;
101+
text-indent: 0;
102+
color: @darkSkies;
103+
list-style: decimal;
104+
background-color: @clear;
105+
}
101106
}
102107
}
103108

104-
/* Tomorrow Theme */
105-
/* Original theme - https://github.com/chriskempson/tomorrow-theme */
106-
/* Pretty printing styles. Used with prettify.js. */
107-
/* SPAN elements with the classes below are added by prettyprint. */
108-
/* plain text */
109-
110-
code.prettyprint {
111-
padding:0 !Important;
112-
}
109+
// Tomorrow Theme (https://github.com/chriskempson/tomorrow-theme)
113110

114111
.pln {
115112
color: @darkSkies;
116113
}
117114

118115
@media screen {
119-
/* string content */
116+
// string content
120117
.str {
121-
color:@str-color;
118+
color: @str-color;
122119
}
123120

124-
/* a keyword */
121+
// a keyword
125122
.kwd {
126-
color:@kwd-color;
123+
color: @kwd-color;
127124
}
128125

129-
/* a comment */
126+
// a comment
130127
.com {
131128
color: @com-color;
132129
}
133130

134-
/* a type name */
131+
// a type name
135132
.typ {
136133
color: @type-color;
137134
}
138135

139-
/* a literal value */
136+
// a literal value
140137
.lit {
141138
color: @lit-color;
142139
}
143140

144-
/* punctuation */
141+
// punctuation
145142
.pun {
146143
color: @pun-color;
147144
}
148145

149-
/* lisp open bracket */
146+
// lisp open bracket
150147
.opn {
151148
color: @opn-color;
152149
}
153150

154-
/* lisp close bracket */
151+
// lisp close bracket
155152
.clo {
156153
color: @clo-color;
157154
}
158155

159-
/* a markup tag name */
156+
// a markup tag name
160157
.tag {
161158
color: @tag-color;
162159
}
163160

164-
/* a markup attribute name */
161+
// a markup attribute name
165162
.atn {
166163
color: @atn-color;
167164
}
168165

169-
/* a markup attribute value */
166+
// a markup attribute value
170167
.atv {
171168
color: @atv-color;
172169
}
173170

174-
/* a declaration */
171+
// a declaration
175172
.dec {
176173
color: @dec-color;
177174
}
178175

179-
/* a variable name */
176+
// a variable name
180177
.var {
181178
color: @var-color;
182179
}
183180

184-
/* a function name */
181+
// a function name
185182
.fun {
186183
color: @var-color;
187184
}
188185
}
189-
/* Use higher contrast and text-weight for printable form. */
186+
187+
// increase contrast and text-weight for print/projection
190188
@media print, projection {
191189
.str {
192190
color: @str-color-pp;
@@ -208,7 +206,7 @@ code.prettyprint {
208206
}
209207

210208
.lit {
211-
color:@lit-color-pp;
209+
color: @lit-color-pp;
212210
}
213211

214212
.pun, .opn, .clo {
@@ -228,45 +226,28 @@ code.prettyprint {
228226
color: @atv-color-pp;
229227
}
230228
}
231-
/* Style */
232-
pre.prettyprint {
233-
//background: @pp-bg;
234-
font-family: Menlo, "Bitstream Vera Sans Mono", "DejaVu Sans Mono", Monaco, Consolas, monospace;
235-
font-size: 14px;
236-
border: 1px solid @haze;
237-
padding: 10px;
238-
}
239229

240-
pre.prettyprint ol {
241-
font-size: 14px;
242-
margin-bottom: 0px;
243-
}
244-
245-
/* Specify class=linenums on a pre to get line numbering */
230+
// specify class=linenums on a pre to get line numbering
246231
ol.linenums {
247232
margin-top: 0;
248233
margin-bottom: 0;
249234
}
250235

251-
/* IE indents via margin-left */
252-
li.L0,
253-
li.L1,
254-
li.L2,
255-
li.L3,
256-
li.L4,
257-
li.L5,
258-
li.L6,
259-
li.L7,
260-
li.L8,
261-
li.L9 {
262-
/* */
263-
}
264-
265-
/* Alternate shading for lines */
266-
li.L1,
267-
li.L3,
268-
li.L5,
269-
li.L7,
270-
li.L9 {
271-
/* */
272-
}
236+
// ie indents via margin-left
237+
li.l0,
238+
li.l1,
239+
li.l2,
240+
li.l3,
241+
li.l4,
242+
li.l5,
243+
li.l6,
244+
li.l7,
245+
li.l8,
246+
li.l9 {}
247+
248+
// alternate shading for lines
249+
li.l1,
250+
li.l3,
251+
li.l5,
252+
li.l7,
253+
li.l9 {}

0 commit comments

Comments
 (0)