diff options
Diffstat (limited to 'doc/syntax.texi')
-rw-r--r-- | doc/syntax.texi | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/doc/syntax.texi b/doc/syntax.texi new file mode 100644 index 0000000..8aca39d --- /dev/null +++ b/doc/syntax.texi | |||
@@ -0,0 +1,44 @@ | |||
1 | @c Syntax highlighting for texinfo's HTML output | ||
2 | |||
3 | @html | ||
4 | <script src="highlight.pack.js"></script> | ||
5 | <script> | ||
6 | var hls = []; | ||
7 | var syntaxAuto = true; | ||
8 | addEventListener("DOMContentLoaded", function() { | ||
9 | // Highlight blocks with fixed language | ||
10 | for (let x of hls) { | ||
11 | let next = x[0].nextElementSibling; | ||
12 | console.log("next", next); | ||
13 | let blocks = next.querySelectorAll("pre.example"); | ||
14 | for (let i = 0; i < blocks.length; i++) { | ||
15 | blocks[i].classList.add("language-" + x[1]); | ||
16 | hljs.highlightBlock(blocks[i]); | ||
17 | } | ||
18 | } | ||
19 | // auto-detect other blocks if not disabled | ||
20 | if (syntaxAuto) { | ||
21 | let blocks = document.querySelectorAll("pre.example"); | ||
22 | for (let i = 0; i < blocks.length; i++) { | ||
23 | hljs.highlightBlock(blocks[i]); | ||
24 | } | ||
25 | } | ||
26 | }); | ||
27 | </script> | ||
28 | @end html | ||
29 | |||
30 | @macro setsyntax{lang} | ||
31 | @html | ||
32 | <script> | ||
33 | hls.push([document.currentScript, "\lang\"]); | ||
34 | </script> | ||
35 | @end html | ||
36 | @end macro | ||
37 | |||
38 | @macro setsyntaxnoauto{} | ||
39 | @html | ||
40 | <script> | ||
41 | syntaxAuto = false; | ||
42 | </script> | ||
43 | @end html | ||
44 | @end macro | ||