Skip to content

Commit 0730d16

Browse files
committed
Better syntax highlighting in tutorial.
1 parent 699351d commit 0730d16

File tree

2 files changed

+36
-3
lines changed

2 files changed

+36
-3
lines changed

tutorial.css

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ body {
2727
width: 480px;
2828
background-color: rgb(40, 44, 52);
2929
font-family: 'firacode';
30-
font-size: 16px;
30+
font-size: 14px;
3131
color: #ffffff;
3232
line-height: 1.2em;
3333
}
@@ -90,13 +90,13 @@ pre code {
9090
padding: 0.5em;
9191
background-color: rgb(50, 54, 62) !important;
9292
color: rgb(50, 54, 62);
93-
font-size: 16px;
93+
font-size: 14px;
9494
}
9595

9696
.hljs {
9797
background-color: rgb(50, 54, 62) !important;
9898
color: rgb(252, 253, 252) !important;
99-
font-size: 16px;
99+
font-size: 14px;
100100
}
101101

102102
.hljs-keyword {
@@ -107,6 +107,29 @@ pre code {
107107
color: rgb(250, 220, 100) !important;
108108
}
109109

110+
.hljs-string {
111+
color: rgb(255, 100, 100) !important;
112+
}
113+
110114
.hljs-number {
111115
color: rgb(255, 100, 100) !important;
112116
}
117+
118+
.hljs-drgtk {
119+
color: rgb(220, 220, 220) !important;
120+
font-weight: 900;
121+
}
122+
123+
.hljs-comment {
124+
color :rgb(180, 255, 200) !important;
125+
}
126+
127+
a {
128+
background-color: rgb(50, 180, 180);
129+
padding-left: 5px;
130+
padding-right: 5px;
131+
border-radius: 5px;
132+
font-weight: 900;
133+
color: #151515;
134+
}
135+
a:visited { color: #151515; }

tutorial.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
var styleElement = document.createElement('style');
22
document.getElementsByTagName("head")[0].appendChild(styleElement);
33

4+
document.addEventListener('load', () => {
5+
hljs.getLanguage('ruby').keywords += ' args tick ';
6+
})
7+
48
document.addEventListener("animationstart", e => {
59
if (e.animationName == "node-ready") {
610
var code = e.target.innerHTML.replace(/^\n/, "");
@@ -12,6 +16,12 @@ document.addEventListener("animationstart", e => {
1216
code = code.split('\n').map(l => l.replace(new RegExp('^' + whiteSpace + ''), '')).join('\n');
1317
}
1418

19+
code = code.replace(/args\.outputs\.sprites/g, '<span class="hljs-drgtk">args.outputs.sprites</span>')
20+
code = code.replace(/args\.outputs\.labels/g, '<span class="hljs-drgtk">args.outputs.labels</span>')
21+
code = code.replace(/args\.state\.tick_count/g, '<span class="hljs-drgtk">args.state.</span><span class="hljs-drgtk">tick_count</span>')
22+
code = code.replace(/args\.state\./g, '<span class="hljs-drgtk">args.state</span>.')
23+
code = code.replace(/args\.inputs\.keyboard/g, '<span class="hljs-drgtk">args.inputs.keyboard</span>')
24+
1525
e.target.innerHTML = code;
1626
hljs.highlightBlock(e.target);
1727
e.target.classList.add("fade-in");

0 commit comments

Comments
 (0)