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
/**
* The maths renderer, fetched when a formula first needs it.
*
* KaTeX is a third of the bundle — 265kB of JavaScript, 23kB of CSS and
* nineteen fonts — and most of what this server shows has no maths in it at
* all: of fifty titles sampled from the store, none carried a formula. Loading
* it with the app made every reader of a list of blog posts download a TeX
* engine to render no TeX.
*
* So it is imported on demand. Until it arrives a formula is shown as it was
* written, `$E = mc^2$` and all, which is what the source says and is no worse
* than the blank the alternative would leave; the import is requested at the
* same moment, and the state here is read during a component's render, so the
* formula redraws itself when the engine lands.
*/
let renderer =
let loading = false
/** The engine, or `null` while it is still on its way. */
export
/** Ask for the engine, once. Returns nothing: the state above is the answer. */
export