all repos — h3rald @ 6d0e79476839498d70f89177fc0e0c6a06422bd0

The sources of https://h3rald.com

Implementing highlighting.
h3rald h3rald@h3rald.com
Sat, 17 Feb 2024 16:19:15 +0100
commit

6d0e79476839498d70f89177fc0e0c6a06422bd0

parent

c5c924080e2ffa2f0b867f2eb2e224f99e3d9587

1 files changed, 17 insertions(+), 0 deletions(-)

jump to
M rules.minrules.min

@@ -99,6 +99,22 @@ asset "output/articles/$1/$1" (name) => % %id @asset

asset output-cp ) ^copy-pdf-article-asset +; Syntax highlighting +( + symbol process-code + (str :text ==> str :result) + ( + "echo \"$#\" | chroma --html --html-only --html-prevent-surrounding-pre" :cmd + text "<code[^>]*>([\s\S]+?)</code>" ( + :match + match 1 get escape :code + cmd (code) =% run /output :out + "<code>$#</code>" (out) =% + ) replace-apply @result + + ) +) :: + ; Process :icon: markup ( symbol process-icons

@@ -151,6 +167,7 @@ (content /ext ".md" ==) (contents content markdown @contents) when

content contents %contents @content tpl content mustache @page id page process-icons @page + id page process-code @page content page %contents @content ( ((id "^(glyph|ruby-compendium)\/book" match?) ()) ;Do not add index.html