Skip to content

Commit 8829c99

Browse files
committed
Update code style
There were some changes to code styling (via highlight.js) with the update to Markdeep 1.15, plus we wanted to just revisit our code styling, both in fenced blocks and inline. Ultimately, I didn't find any improvement to our inline style. For the general code style, I made preprocessor '#' characters and the preprocessor keywords get the same styling. I also suppressed styling for built-ins, parameters, types, and literals. I also tweaked the background for deleted lines as well, to make it a bit more desaturated. In addition, I've added book-highlight-test.css, which can be used to identify the various syntactic elements for styling. See the header for usage information. Resolves #868 Resolves #1166
1 parent fc8ebaf commit 8829c99

File tree

2 files changed

+78
-1
lines changed

2 files changed

+78
-1
lines changed

style/book-highlight-test.css

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/* -------------------------------------------------------------------------------------------------
2+
** Code Highlighting Style Test
3+
**
4+
** To use these test styles, go to the bottom of the Markdeep document and find the line containing
5+
**
6+
** <link rel='stylesheet' href='../style/book.css'>
7+
**
8+
** Add this line following:
9+
**
10+
** <link rel='stylesheet' href='../style/book-highlight-test.css'>
11+
**
12+
** -----------------------------------------------------------------------------------------------*/
13+
14+
.md pre.listing.tilde {
15+
border: solid 3px #d4d4d4;
16+
padding: 1.5ex;
17+
min-width: 96%;
18+
width: fit-content;
19+
background: #eee;
20+
}
21+
22+
.md code {
23+
/* All code, both in fenced blocks and inline. */
24+
font-family: Consolas, Menlo, monospace;
25+
font-size: 86%;
26+
color: #000;
27+
background: #eee;
28+
}
29+
30+
.md pre.listing.tilde code {
31+
/* Only code in fenced blocks. */
32+
letter-spacing: -0.20;
33+
background: #eee;
34+
}
35+
36+
/* Hilight.js Syntax Coloring */
37+
38+
.hljs-attr { color: #0ff; } /* Cyan Bright */
39+
.hljs-built_in { color: #0cc; } /* Cyan */
40+
.hljs-comment { color: #00f; } /* Blue */
41+
.hljs-doctag { color: #fff; } /* White */
42+
.hljs-function .hljs-title { color: #f00; } /* Red */
43+
.hljs-keyword { color: #0a0; } /* Green Dark */
44+
.hljs-literal { color: #00a; } /* Blue Dark */
45+
.hljs-meta { color: #ff0; } /* Yellow Bright */
46+
.hljs-keyword { color: #f0f; } /* Purple Bright */
47+
.hljs-meta .hljs-keyword { color: #fa0; } /* Orange */
48+
.hljs-name { color: #0ff; font-weight: 900; } /* Cyan Bright Extra Bold */
49+
.hljs-number { color: #f00; text-decoration: underline; } /* Red Underline */
50+
.hljs-operator { color: #fff; } /* White */
51+
.hljs-params { color: #f00; font-style: italic; } /* Red Italic */
52+
.hljs-string { color: #aaa; } /* Gray */
53+
.hljs-tag { font-weight: 900; } /* Extra Bold */
54+
.hljs-title { color: #b0b; } /* Purple Dark */
55+
.hljs-class_ { color: #0f0; } /* Green Bright */
56+
.hljs-type { color: #f00; font-weight: 900; } /* Red extra bold */
57+
58+
/* Code Line Types */
59+
60+
.md code > .highlight {
61+
background-color: #ccdbc8;
62+
}
63+
64+
.md code > .delete {
65+
text-decoration: line-through;
66+
background-color: #;
67+
color: #a0a0a0;
68+
background: #e0cfcc;
69+
}

style/book.css

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,18 @@ div.indented {
101101

102102
/* Hilight.js Syntax Coloring */
103103

104+
.hljs-built_in, .hljs-params, .hljs-type, .hljs-literal {
105+
color: #222;
106+
}
107+
104108
.hljs-comment {
105109
color: #40f;
106110
}
107111

112+
.hljs-meta .hljs-keyword {
113+
color: #f40;
114+
}
115+
108116
.hljs-keyword {
109117
color: #a62;
110118
}
@@ -131,7 +139,7 @@ div.indented {
131139
text-decoration: line-through;
132140
background-color: #;
133141
color: #a0a0a0;
134-
background: #f4dcd8;
142+
background: #e0cfcc;
135143
}
136144

137145
.md div.listingcaption {

0 commit comments

Comments
 (0)