Skip to content

Commit de80a04

Browse files
committed
Fix syntax highlighting
Before we switched to kramdown, our syntax highlighting was handled by a combination of pygments and highlight.js. Basically, pygments output some esoteric classes throughout each code block, and it also output the language of the code block (from markdown) into the html. Highlight.js then read this language indicator, used it to do its own parsing, and added a different set of classes to each code block. Then, our css mostly used the highlight.js class names to do the styling, but we occasionally took advantage of the pygments ones too to make the styling more precise than just highlight’s classes would have allowed. Then, with the switch to kramdown, we had to switch our syntax highlighter from pygments to rouge. Rouge output the same class names as pygments but, crucially, it didn’t pass through the language name of each code block to the HTML. That meant that highlight.js had to detect each automatically language, rather than reading the language code. That wouldn’t have been a problem except that many of our json code blocks aren’t strictly json (e.g. they contain comments) and we’d been using the language code in the HTML to force highlight.js to parse them as JSON anyway. With that language code gone, highlight.js was failing to identify the language and so wasn’t highlighting the code at all. We could’ve tried a few things: 1. Sending a PR to rouge to output the language tag. Even if this PR were accepted, though, the updated rouge dependency wouldn’t have been adopted by github pages until after redcarpets support was turned off, so our highlighting would’ve been broken until then. 2. Pass through the language code some other way. E.g., write `<pre>` tags manually in our markdown with the relevant class name. This could’ve worked, but it would have made authoring the markdown messier, and harder for others to contribute, so I didn’t want to do that. 3. Get highlight.js to auto detect and parse our malformed json correctly, so that the language codes are unnecessary. I went with option 3, replacing highlight’s built-in json language definition with a new definition called “jsonlike” which works on our site. Then, this commit includes the raw, edited highlight source files and an updated build. Note: this build uses highlight 8.9.1, because version 9 contained some backwards-incompatible class name changes. Lastly, this commit includes some css tweaks to match rouge’s small changes in the HTML wrapping highlighted code blocks, and our new highlighting strategy more accurately categorizing comments.
1 parent 12931a4 commit de80a04

File tree

407 files changed

+21206
-28
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

407 files changed

+21206
-28
lines changed

_format/1.0/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ The following `self` link is simply a URL:
518518

519519
```json
520520
"links": {
521-
"self": "http://example.com/posts",
521+
"self": "http://example.com/posts"
522522
}
523523
```
524524

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[*]
2+
end_of_line = lf
3+
insert_final_newline = true
4+
5+
[*.{js,css}]
6+
charset = utf-8
7+
indent_style = space
8+
indent_size = 2
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.DS_Store
2+
build
3+
docs/_build
4+
.idea/
5+
__pycache__
6+
*.swp
7+
node_modules
8+
.project
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
language: node_js
2+
node_js:
3+
- "0.12"
4+
script:
5+
- "node tools/build.js -t node"
6+
- "npm test"
7+
8+
sudo: false # Use container-based architecture
Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
Syntax highlighting with language autodetection.
2+
3+
URL: https://highlightjs.org/
4+
5+
Core developers (in order of appearance):
6+
7+
- Ivan Sagalaev (original author) <[email protected]>
8+
- Jeremy Hull <[email protected]>
9+
- Oleg Efimov <[email protected]>
10+
11+
Contributors:
12+
13+
- Peter Leonov <[email protected]>
14+
- Victor Karamzin <[email protected]>
15+
- Vsevolod Solovyov <[email protected]>
16+
- Anton Kovalyov <[email protected]>
17+
- Nikita Ledyaev <[email protected]>
18+
- Konstantin Evdokimenko <[email protected]>
19+
- Dmitri Roudakov <[email protected]>
20+
- Yuri Ivanov <[email protected]>
21+
- Vladimir Ermakov <[email protected]>
22+
- Vladimir Gubarkov <[email protected]>
23+
- Brian Beck <[email protected]>
24+
- MajestiC <[email protected]>
25+
- Vasily Polovnyov <[email protected]>
26+
- Vladimir Epifanov <[email protected]>
27+
- Alexander Makarov <[email protected]>
28+
29+
- Shuen-Huei Guan <[email protected]>
30+
- Jason Diamond <[email protected]>
31+
- Michal Gabrukiewicz <[email protected]>
32+
- Ruslan Keba <[email protected]>
33+
- Sergey Baranov <[email protected]>
34+
- Zaripov Yura <[email protected]>
35+
- Oleg Volchkov <[email protected]>
36+
- Vasily Mikhailitchenko <[email protected]>
37+
- Jan Berkel <[email protected]>
38+
- Vladimir Moskva <[email protected]>
39+
- Loren Segal <[email protected]>
40+
- Andrew Fedorov <[email protected]>
41+
- Igor Kalnitsky <[email protected]>
42+
- Valerii Hiora <[email protected]>
43+
- Nikolay Zakharov <[email protected]>
44+
- Dmitry Kovega <[email protected]>
45+
- Sergey Ignatov <[email protected]>
46+
- Antono Vasiljev <[email protected]>
47+
- Stephan Kountso <[email protected]>
48+
49+
- John Crepezzi <[email protected]>
50+
- Andrey Vlasovskikh <[email protected]>
51+
- Alexander Myadzel <[email protected]>
52+
- Evgeny Stepanischev <[email protected]>
53+
- Dmytrii Nagirniak <[email protected]>
54+
- Luigi Maselli <[email protected]>
55+
- Denis Bardadym <[email protected]>
56+
- Aahan Krish <[email protected]>
57+
- Ilya Baryshev <[email protected]>
58+
- Aleksandar Ruzicic <[email protected]>
59+
- Joe Cheng <[email protected]>
60+
- Angel G. Olloqui <[email protected]>
61+
- Jason Tate <[email protected]>
62+
- Sergey Tikhomirov <[email protected]>
63+
- Marc Fornos <[email protected]>
64+
- Yoshihide Jimbo <[email protected]>
65+
- Casey Duncan <[email protected]>
66+
- Eugene Nizhibitsky <[email protected]>
67+
- Alberto Gimeno <[email protected]>
68+
- Kirk Kimmel <[email protected]>
69+
- Nathan Grigg <[email protected]>
70+
- Dr. Drang <[email protected]>
71+
- Robin Ward <[email protected]>
72+
- Dmitry Medvinsky <[email protected]>
73+
- Jason Jacobson <[email protected]>
74+
- Jonas Follesø <[email protected]>
75+
- Dan Allen <[email protected]>
76+
- noformnocontent <[email protected]>
77+
- Damien White <[email protected]>
78+
- Alexander Marenin <[email protected]>
79+
- Cédric Néhémie <[email protected]>
80+
- Simon Madine <[email protected]>
81+
- Benjamin Pannell <[email protected]>
82+
- Eric Knibbe <[email protected]>
83+
- Poren Chiang <[email protected]>
84+
- Kelley van Evert <[email protected]>
85+
- Kurt Emch <[email protected]>
86+
- Mehdi Dogguy <[email protected]>
87+
- Nicolas Braud-Santoni <[email protected]>
88+
- Ralf Bitter <[email protected]>
89+
- Sylvestre Ledru <[email protected]>
90+
- Troy Kershaw <[email protected]>
91+
- Zena Treep <[email protected]>
92+
- Daniel Kvasnicka <[email protected]>
93+
- Carlo Kok <[email protected]>
94+
- Bram de Haan <[email protected]>
95+
- Seongwon Lee <[email protected]>
96+
- Zaven Muradyan <[email protected]>
97+
- Jan T. Sott <[email protected]>
98+
- Brent Bradbury <[email protected]>
99+
- Martin Dilling-Hansen <[email protected]>
100+
- Ilya Vassilevsky <[email protected]>
101+
- Josh Adams <[email protected]>
102+
- Dan Tao <[email protected]>
103+
- Jeff Escalante <[email protected]>
104+
- Jun Yang <[email protected]>
105+
- Nikolay Lisienko <[email protected]>
106+
- Heiko August <[email protected]>
107+
- Domen Kožar <[email protected]>
108+
- Travis Odom <[email protected]>
109+
- innocenat <[email protected]>
110+
- Arthur Bikmullin <[email protected]>
111+
- Pascal Hurni <[email protected]>
112+
- Roman Shmatov <[email protected]>
113+
- Nic West <[email protected]>
114+
- Panu Horsmalahti <[email protected]>
115+
- Flaviu Tamas <[email protected]>
116+
- Damian Mee <[email protected]>
117+
- Christopher Kaster <[email protected]>
118+
- Chris Eidhof <[email protected]>
119+
- Nate Cook <[email protected]>
120+
- Matt Diephouse <[email protected]>
121+
- Erik Osheim <[email protected]>
122+
- Guillaume Laforge <[email protected]>
123+
- Lucas Mazza <[email protected]>
124+
- Maxim Dikun <[email protected]>
125+
- Henrik Feldt <[email protected]>
126+
- Anton Kochkov <[email protected]>
127+
- Michael Allen <[email protected]>
128+
- JP Verkamp <[email protected]>
129+
- Adam Joseph Cook <[email protected]>
130+
- Sergey Vidyuk <[email protected]>
131+
- Radek Liska <[email protected]>
132+
- Jose Molina Colmenero <[email protected]>
133+
- Max Mikhailov <[email protected]>
134+
- Bryant Williams <[email protected]>
135+
- Erik Paluka <[email protected]>
136+
- Luke Holder <[email protected]>
137+
- David Mohundro <[email protected]>
138+
- Nicholas Blumhardt <[email protected]>
139+
- Christophe de Dinechin <[email protected]>
140+
- Taneli Vatanen <[email protected]>
141+
- Jen Evers-Corvina <[email protected]>
142+
- Kassio Borges <[email protected]>
143+
- Cedric Sohrauer <[email protected]>
144+
- Mickaël Delahaye <[email protected]>
145+
- Hakan Özler <[email protected]>
146+
- Trey Shugart <[email protected]>
147+
- Vincent Zurczak <[email protected]>
148+
- Adam Joseph Cook <[email protected]>
149+
- Edwin Dalorzo <[email protected]>
150+
151+
- Dennis Titze <[email protected]>
152+
- Jon Evans <[email protected]>
153+
- Brian Quistorff <[email protected]>
154+
- Jonathan Suever <[email protected]>
155+
- Alexis Hénaut <[email protected]>
156+
- Chris Kiehl <[email protected]>
157+
- Peter Piwowarski <[email protected]>
158+
- Kenta Sato <[email protected]>
159+
- Anthony Scemama <[email protected]>
160+
- Taufik Nurrohman <[email protected]>
161+
- Pedro Oliveira <[email protected]>
162+
- Gu Yiling <[email protected]>
163+
- Thomas Applencourt <[email protected]>
164+
- Andrew Farmer <[email protected]>
165+
- Sergey Mashkov <[email protected]>
166+
- Raivo Laanemets <[email protected]>
167+
- Kenneth Fuglsang <[email protected]>
168+
- David Anson <[email protected]>
169+
- Louis Barranqueiro <[email protected]>
170+
- Tim Schumacher <[email protected]>
171+
- Lucas Werkmeister <[email protected]>
172+
- Dan Panzarella <[email protected]>
173+
- Bruno Dias <[email protected]>
174+
- Jay Strybis <[email protected]>
175+
- Guillaume Gomez <[email protected]>
176+
- Janis Voigtländer <[email protected]>
177+
- Dirk Kirsten <[email protected]>
178+
179+
- Vadimtro <[email protected]>
180+
- Benjamin Auder <[email protected]>
181+
- Dotan Dimet <[email protected]>
182+
- Manh Tuan <[email protected]>
183+
- Philippe Charrière <[email protected]>
184+
- Stefan Bechert <[email protected]>
185+
- Samuel Reed <[email protected]>
186+
- Yury Selivanov <[email protected]>
187+
- Tsuyusato Kitsune <[email protected]>
188+
- Mick MacCallum <[email protected]>
189+
- Kristoffer Gronlund <[email protected]>
190+
- Søren Enevoldsen <[email protected]>
191+
- Daniel Rosenwasser <[email protected]>
192+
- Ladislav Prskavec: <[email protected]>

0 commit comments

Comments
 (0)