-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.html
328 lines (299 loc) · 14.9 KB
/
template.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/reveal.js/4.5.0/reset.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/reveal.js/4.5.0/reveal.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/reveal.js/4.5.0/theme/simple.css" id="theme">
<!-- This is the highlight.js theme bundled in reveal.js -->
<!-- link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/reveal.js/4.5.0/plugin/highlight/monokai.css" -->
<!-- This is the theme we prefer, which we take from highlight.js directly -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.7.0/styles/idea.min.css">
<title>$TITLE</title>
<style>
.open-in-playground {
background: #a42;
font-size: 100%;
color: white;
font-weight: 700;
cursor: pointer;
float: left;
}
.reveal h2 code {
font-size: 80%;
}
.reveal code {
/* inline code using backticks */
background: #f0f0f0;
}
.reveal pre code {
/* multi-line code blocks using triple backticks */
background: #fcfcfc;
}
.reveal blockquote {
background: #eee;
}
.reveal blockquote p::before {
content: open-quote;
}
.reveal blockquote p::after {
content: close-quote;
}
.branding {
height: 7%;
position: absolute;
margin-top: 1em;
margin-left: 1em;
}
.reveal .branding__logo {
height: auto;
margin: 0;
}
</style>
</head>
<body>
<div class="reveal">
<div class="slides">
<section data-markdown>
<textarea data-template>
$CONTENT
</textarea>
</section>
</div> <!-- class="slides" -->
<div class="branding">
<img class="branding__logo" src="./images/logo_ferrous-systems_rgb.png" alt="The Ferrous logo. A colorful stylised F looking to the left and the words Ferrous Systems.">
</div>
</div> <!-- class="reveal" -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/reveal.js/4.5.0/reveal.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/reveal.js/4.5.0/plugin/notes/notes.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/reveal.js/4.5.0/plugin/markdown/markdown.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/reveal.js/4.5.0/plugin/highlight/highlight.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.7.0/highlight.min.js"></script>
<!-- Stick with mermaid 9.x as 10.x uses ESM -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/mermaid/9.4.0/mermaid.js"></script>
<script src="https://code.jquery.com/jquery-3.6.4.min.js" crossorigin="anonymous"></script>
<script>
const buttons = '<p><button class="open-in-playground">RUN</button></p>\n';
function addButtons() {
$('pre code.rust:not(.fragment)').each(function (i, block) {
$(block).parent().append(buttons);
});
$('.open-in-playground').click(function () {
const baseUrl = 'https://play.rust-lang.org/?version=stable&edition=2018&code=';
const code = $(this).parent().parent().children('code')[0].cloneNode(true);
var payload;
const content = code.firstChild;
if (content.tagName == "TABLE") {
// We have line numbers
var source = "";
for (let row of content.rows) {
// Source is in the second column. The first column is line numbers.
source += row.cells[1].innerText + "\n";
}
payload = encodeURIComponent(source);
} else {
// We do not have line numbers
payload = encodeURIComponent(code.innerText);
}
const url = baseUrl + payload;
window.open(url, '_blank');
});
}
$(document).ready(function () {
// More info about config & dependencies:
// - https://github.com/hakimel/reveal.js#configuration
// - https://github.com/hakimel/reveal.js#dependencies
Reveal.initialize({
// Display presentation control arrows
controls: true,
// Help the user learn the controls by providing hints, for example by
// bouncing the down arrow when they first encounter a vertical slide
controlsTutorial: true,
// Determines where controls appear, "edges" or "bottom-right"
controlsLayout: 'bottom-right',
// Visibility rule for backwards navigation arrows; "faded", "hidden"
// or "visible"
controlsBackArrows: 'faded',
// Display a presentation progress bar
progress: true,
// Display the page number of the current slide
slideNumber: true,
// Control which views the slide number displays on
showSlideNumber: 'all',
// Add the current slide number to the URL hash so that reloading the
// page/copying the URL will return you to the same slide
hash: true,
// Push each slide change to the browser history. Implies `hash: true`
history: false,
// Enable keyboard shortcuts for navigation
keyboard: true,
// Enable the slide overview mode
overview: true,
// Disables the default reveal.js slide layout so that you can use custom CSS layout
disableLayout: false,
// Vertical centering of slides
center: true,
// Enables touch navigation on devices with touch input
touch: true,
// Loop the presentation
loop: false,
// Change the presentation direction to be RTL
rtl: false,
// See https://github.com/hakimel/reveal.js/#navigation-mode
navigationMode: 'default',
// Randomizes the order of slides each time the presentation loads
shuffle: false,
// Turns fragments on and off globally
fragments: true,
// Flags whether to include the current fragment in the URL,
// so that reloading brings you to the same fragment position
fragmentInURL: false,
// Flags if the presentation is running in an embedded mode,
// i.e. contained within a limited portion of the screen
embedded: false,
// Flags if we should show a help overlay when the questionmark
// key is pressed
help: true,
// Flags if speaker notes should be visible to all viewers
showNotes: false,
// Global override for autolaying embedded media (video/audio/iframe)
// - null: Media will only autoplay if data-autoplay is present
// - true: All media will autoplay, regardless of individual setting
// - false: No media will autoplay, regardless of individual setting
autoPlayMedia: null,
// Global override for preloading lazy-loaded iframes
// - null: Iframes with data-src AND data-preload will be loaded when within
// the viewDistance, iframes with only data-src will be loaded when visible
// - true: All iframes with data-src will be loaded when within the viewDistance
// - false: All iframes with data-src will be loaded only when visible
preloadIframes: null,
// Number of milliseconds between automatically proceeding to the
// next slide, disabled when set to 0, this value can be overwritten
// by using a data-autoslide attribute on your slides
autoSlide: 0,
// Stop auto-sliding after user input
autoSlideStoppable: true,
// Use this method for navigation when auto-sliding
autoSlideMethod: Reveal.navigateNext,
// Specify the average time in seconds that you think you will spend
// presenting each slide. This is used to show a pacing timer in the
// speaker view
defaultTiming: 60,
// Specify the total time in seconds that is available to
// present. If this is set to a nonzero value, the pacing
// timer will work out the time available for each slide,
// instead of using the defaultTiming value
// Set to 60 minutes, because this training is 3x 1 hour blocks
totalTime: 3600,
// Specify the minimum amount of time you want to allot to
// each slide, if using the totalTime calculation method. If
// the automated time allocation causes slide pacing to fall
// below this threshold, then you will see an alert in the
// speaker notes window
minimumTimePerSlide: 0,
// Enable slide navigation via mouse wheel
mouseWheel: false,
// Hide cursor if inactive
hideInactiveCursor: true,
// Time before the cursor is hidden (in ms)
hideCursorTime: 5000,
// Hides the address bar on mobile devices
hideAddressBar: true,
// Opens links in an iframe preview overlay
// Add `data-preview-link` and `data-preview-link="false"` to customise each link
// individually
previewLinks: false,
// Transition style (e.g., none, fade, slide, convex, concave, zoom)
transition: 'none',
// Transition speed (e.g., default, fast, slow)
transitionSpeed: 'default',
// Transition style for full page slide backgrounds (e.g., none, fade, slide, convex, concave, zoom)
backgroundTransition: 'fade',
// Number of slides away from the current that are visible
viewDistance: 3,
// Number of slides away from the current that are visible on mobile
// devices. It is advisable to set this to a lower number than
// viewDistance in order to save resources.
mobileViewDistance: 3,
// Parallax background image (e.g., "'https://s3.amazonaws.com/hakim-static/reveal-js/reveal-parallax-1.jpg'")
parallaxBackgroundImage: '',
// Parallax background size in CSS syntax (e.g., "2100px 900px")
parallaxBackgroundSize: '',
// Number of pixels to move the parallax background per slide
// - Calculated automatically unless specified
// - Set to 0 to disable movement along an axis
parallaxBackgroundHorizontal: null,
parallaxBackgroundVertical: null,
// The display mode that will be used to show slides
display: 'block',
// The "normal" size of the presentation, aspect ratio will be preserved
// when the presentation is scaled to fit different resolutions. Can be
// specified using percentage units.
width: 1280,
height: 720,
// Factor of the display size that should remain empty around the content
margin: 0.1,
// Bounds for smallest/largest possible scale to apply to content
minScale: 0.2,
maxScale: 1.5,
// PDF Export Options
// Put each fragment on a separate page
pdfSeparateFragments: true,
// For slides that do not fit on a page, max number of pages
pdfMaxPagesPerSlide: 1,
highlight: {
highlightOnLoad: false
},
plugins: [RevealMarkdown, RevealHighlight, RevealNotes]
}).then(() => {
addButtons();
const highlight = Reveal.getPlugin('highlight');
$('pre code.rust').each(function (i, el) {
highlight.highlightBlock(el);
});
$('pre code.sh').each(function (i, el) {
highlight.highlightBlock(el);
});
$('pre code.console').each(function (i, el) {
highlight.highlightBlock(el);
});
$('pre code.wat').each(function (i, el) {
highlight.highlightBlock(el);
});
$('pre code.c').each(function (i, el) {
highlight.highlightBlock(el);
});
$('pre code.toml').each(function (i, el) {
highlight.highlightBlock(el);
});
$('pre code.mermaid').each(function (i, el) {
// Center the mermaid diagrams.
el.style.cssText += 'text-align: center';
});
mermaid.initialize({
startOnLoad: false,
themeCSS: '.label { font-size: 28px; }'
});
let doMermaidStuff = function doMermaidStuff(event) {
let mermaidDivs = event.currentSlide.querySelectorAll('.mermaid:not(.done)');
let indices = Reveal.getIndices();
let pageno = `${indices.h}-${indices.v}`
mermaidDivs.forEach(function (mermaidDiv, i) {
let insertSvg = function (svgCode, bindFunctions) {
mermaidDiv.innerHTML = svgCode;
mermaidDiv.classList.add('done');
};
let graphDefinition = mermaidDiv.textContent;
mermaid.mermaidAPI.render(`mermaid${pageno}-${i}`, graphDefinition, insertSvg);
});
Reveal.layout();
};
Reveal.on('ready', event => doMermaidStuff(event));
Reveal.on('slidechanged', event => doMermaidStuff(event));
});
});
</script>
</body>
</html>