lol

nixpkgs docs: syntax highlight

+30 -5
+1
doc/.gitignore
··· 3 3 .version 4 4 out 5 5 manual-full.xml 6 + highlightjs
+21 -3
doc/Makefile
··· 6 6 .PHONY: debug 7 7 debug: 8 8 nix-shell --run "xmloscopy --docbook5 ./manual.xml ./manual-full.xml" 9 + 9 10 .PHONY: clean 10 11 clean: 11 12 rm -f ${MD_TARGETS} .version manual-full.xml 12 - rm -rf ./out/ 13 + rm -rf ./out/ ./highlightjs 13 14 14 15 .PHONY: validate 15 16 validate: manual-full.xml 16 17 jing "$$RNG" manual-full.xml 17 18 18 - out/html/index.html: manual-full.xml style.css 19 + out/html/index.html: manual-full.xml style.css highlightjs 19 20 mkdir -p out/html 20 21 xsltproc ${xsltFlags} \ 21 22 --nonet --xinclude \ ··· 23 24 "$$XSL/docbook/xhtml/docbook.xsl" \ 24 25 ./manual-full.xml 25 26 27 + mkdir -p out/html/highlightjs/ 28 + echo "document.onreadystatechange = function () { \ 29 + var listings = document.querySelectorAll('.programlisting, .screen'); \ 30 + for (i = 0; i < listings.length; ++i) { \ 31 + hljs.highlightBlock(listings[i]); \ 32 + } \ 33 + } " > out/html/highlightjs/loader.js 34 + 35 + cp -r highlightjs out/html/ 36 + 26 37 cp ./overrides.css out/html/ 27 38 cp ./style.css out/html/style.css 28 39 29 40 mkdir -p out/html/images/callouts 30 41 cp "$$XSL/docbook/images/callouts/"*.svg out/html/images/callouts/ 31 - chmod u+w -R out/html/images/ 42 + chmod u+w -R out/html/ 32 43 33 44 out/epub/manual.epub: manual-full.xml 34 45 mkdir -p out/epub/scratch ··· 46 57 rm mimetype 47 58 cd "out/epub/scratch/" && zip -Xr9D "../manual.epub" * 48 59 rm -rf "out/epub/scratch/" 60 + 61 + highlightjs: 62 + mkdir -p highlightjs 63 + cp -r "$$HIGHLIGHTJS/highlight.pack.js" highlightjs/ 64 + cp -r "$$HIGHLIGHTJS/LICENSE" highlightjs/ 65 + cp -r "$$HIGHLIGHTJS/mono-blue.css" highlightjs/ 66 + 49 67 50 68 manual-full.xml: ${MD_TARGETS} .version *.xml 51 69 xmllint --nonet --xinclude --noxincludenode manual.xml --output manual-full.xml
+7 -1
doc/default.nix
··· 11 11 12 12 src = ./.; 13 13 14 + # Hacking on these variables? Make sure to close and open 15 + # nix-shell between each test, maybe even: 16 + # $ nix-shell --run "make clean all" 17 + # otherwise they won't reapply :) 18 + HIGHLIGHTJS = pkgs.documentation-highlighter; 14 19 XSL = "${pkgs.docbook5_xsl}/xml/xsl"; 15 20 RNG = "${pkgs.docbook5}/xml/rng/docbook/docbook.rng"; 16 21 xsltFlags = lib.concatStringsSep " " [ 17 22 "--param section.autolabel 1" 18 23 "--param section.label.includes.component.label 1" 19 - "--stringparam html.stylesheet 'style.css overrides.css'" 24 + "--stringparam html.stylesheet 'style.css overrides.css highlightjs/mono-blue.css'" 25 + "--stringparam html.script './highlightjs/highlight.pack.js ./highlightjs/loader.js'" 20 26 "--param xref.with.number.and.title 1" 21 27 "--param toc.section.depth 3" 22 28 "--stringparam admon.style ''"
+1 -1
doc/style.css
··· 104 104 padding: 3px 3px; 105 105 margin-left: 1.5em; 106 106 margin-right: 1.5em; 107 - color: #600000; 107 + 108 108 background: #f4f4f8; 109 109 font-family: monospace; 110 110 border-radius: 0.4em;