Syntax highlighting.
h3rald h3rald@h3rald.com
Sun, 18 Feb 2024 15:04:02 +0100
2 files changed,
9 insertions(+),
10 deletions(-)
M
assets/styles/chroma.css
→
assets/styles/chroma.css
@@ -55,9 +55,9 @@ padding: 0 0.4em 0 0.4em;
color: #6e7681 } - .chroma .line { + /*.chroma .line { display: flex; - } + }*/ .chroma .k { color: #ff7b72
M
rules.min
→
rules.min
@@ -104,30 +104,29 @@ (
symbol process-code (str :text ==> str :result) ( - "echo \"$#\" | chroma --html --html-only --html-prevent-surrounding-pre" :cmd + "echo '$#' | chroma --html --html-only --html-prevent-surrounding-pre --fail" :cmd text "<pre>\s*<code[^>]*>([\s\S]+?)</code></pre>" ( :match match 1 get escape :code - code "&(gt|lt|quot|amp);" ( + code "(>|<|"|&)" ( :match match 1 get :ntt - (ntt "gt" ==) + (ntt ">" ==) (">") when - (ntt "lt" ==) + (ntt "<" ==) ("<") when - (ntt "quot" ==) + (ntt """ ==) ("\"") when - (ntt "amp" ==) + (ntt "&" ==) ("&") when - ) replace-apply @code + ) replace-apply "\\\\\"" "\"" replace @code cmd (code) =% run /output :out "<pre class=\"chroma\"><code>$#</code></pre>" (out) =% ) replace-apply @result - ) ) ::