summaryrefslogtreecommitdiff
path: root/doc/syntax.texi
blob: 8aca39d8d62fc0ccce73433137e84e6d79424ad5 (plain)
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
@c Syntax highlighting for texinfo's HTML output

@html
<script src="highlight.pack.js"></script>
<script>
var hls = [];
var syntaxAuto = true;
addEventListener("DOMContentLoaded", function() {
  // Highlight blocks with fixed language
  for (let x of hls) {
    let next = x[0].nextElementSibling;
    console.log("next", next);
    let blocks = next.querySelectorAll("pre.example");
    for (let i = 0; i < blocks.length; i++) {
      blocks[i].classList.add("language-" + x[1]);
      hljs.highlightBlock(blocks[i]);
    }
  } 
  // auto-detect other blocks if not disabled
  if (syntaxAuto) {
    let blocks = document.querySelectorAll("pre.example");
    for (let i = 0; i < blocks.length; i++) {
      hljs.highlightBlock(blocks[i]);
    }
  }
});
</script>
@end html

@macro setsyntax{lang}
@html
<script>
hls.push([document.currentScript, "\lang\"]);
</script>
@end html
@end macro

@macro setsyntaxnoauto{}
@html
<script>
syntaxAuto = false;
</script>
@end html
@end macro