Commit 41bb6f12837f53dc88630244534e6b07f4c314ea
1 parent
ed6f5b45b0
Exists in
master
Ajout de la coloration syntaxique dans Print,
malheureusement ce template spécial ne prend pas les ressources et on doit mettre des chemins absolus.
Showing 1 changed file with 34 additions and 1 deletions Side-by-side Diff
templates/html/Print.html
... | ... | @@ -91,7 +91,22 @@ |
91 | 91 | ul {list-style-image: none} |
92 | 92 | /* ul rule needed to reset style for sub-bullets */ |
93 | 93 | </style> |
94 | - | |
94 | + | |
95 | + <!-- ATTENTION Le template Print ne supporte pas les ressources, | |
96 | + Il faut mettre des chemins absolus sur les fichiers :( --> | |
97 | + <!-- Themes clair : | |
98 | + atom-one-light.css, vs.css | |
99 | + Themes sombres : | |
100 | + agate.css, vs2015.css, atom-one-dark.css | |
101 | + Demo live : https://highlightjs.org/static/demo/ --> | |
102 | + <link rel="stylesheet" | |
103 | + href="file:////home/daniau/.local/share/zim/templates/html/Print_via_export/styles/atom-one-light.css" > | |
104 | + <!-- Pour redefinir la police à monospace dans hljs --> | |
105 | + <link rel="stylesheet" | |
106 | + href="file:////home/daniau/.local/share/zim/templates/html/Print_via_export/hljs-zim.css" > | |
107 | + <!-- hljs --> | |
108 | + <script src="file:////home/daniau/.local/share/zim/templates/html/Print_via_export/highlight.pack.js"></script> | |
109 | + | |
95 | 110 | </head> |
96 | 111 | <body> |
97 | 112 | |
... | ... | @@ -104,6 +119,24 @@ |
104 | 119 | [% END %] |
105 | 120 | |
106 | 121 | <!-- End wiki content --> |
122 | + | |
123 | +<script> | |
124 | + /* on remplace octave par plaintext ou nohighlight ou matlab */ | |
125 | + var elements = document.getElementsByTagName("code"); | |
126 | + for (var i=0; i<elements.length; i++) { | |
127 | + var el = elements[i]; | |
128 | + var cl = el.getAttribute("class"); | |
129 | + if (cl == "octave") { | |
130 | + el.setAttribute( "class","matlab"); | |
131 | + } | |
132 | + } | |
133 | + | |
134 | + /* Si on utilise la fonction suivante, c'est execute avant le bout de code ci-dessus */ | |
135 | + /*hljs.initHighlightingOnLoad();*/ | |
136 | + document.querySelectorAll('pre code').forEach((block) => { | |
137 | + hljs.highlightBlock(block); | |
138 | + }); | |
139 | +</script> | |
107 | 140 | |
108 | 141 | </body> |
109 | 142 |