On my index.html page, I have sections with code example, for which I want to use syntax highlighting. However, I cannot use the inbuild highlight function as it does not respect my render-codeblock.html hook, which is for Markdown only.
Nevertheless, I found a working solution by using $.Page.RenderString:
<div class="page">
<div class="example">{{
`import org.tinylog.Logger;
public class Application {
public static void main(String[] args) {
Logger.info("Hello World!");
}
}` | replaceRE `(?s)(.*)` "```java\n$1\n```" | $.Page.RenderString
}}</div>
</div>
However, there are two major disadvantages:
I found no way to escape backticks. Therefore, I use the replaceRE function for adding ```java to the start and ``` to the end.
I cannot indent the code block itself as a whole. This makes my index.html page hard to read as there are many but tiny code examples.