summaryrefslogtreecommitdiff
path: root/doc/syntax.texi
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2017-06-16 03:20:02 +0200
committerFlorian Dold <florian.dold@gmail.com>2017-06-16 03:21:09 +0200
commit7f9e6272fd0e16d060da432c3a9b67c49465470e (patch)
tree7983d22b12fced6392bff6246a2c428951e01dc5 /doc/syntax.texi
parent0e6c4ba898b0f4c7e53b02a65f99cc4b6b066ad7 (diff)
downloadexchange-7f9e6272fd0e16d060da432c3a9b67c49465470e.tar.gz
exchange-7f9e6272fd0e16d060da432c3a9b67c49465470e.tar.bz2
exchange-7f9e6272fd0e16d060da432c3a9b67c49465470e.zip
Styling, no-split and syntax highlighting for texi
Diffstat (limited to 'doc/syntax.texi')
-rw-r--r--doc/syntax.texi44
1 files changed, 44 insertions, 0 deletions
diff --git a/doc/syntax.texi b/doc/syntax.texi
new file mode 100644
index 000000000..8aca39d8d
--- /dev/null
+++ b/doc/syntax.texi
@@ -0,0 +1,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