docsy icon indicating copy to clipboard operation
docsy copied to clipboard

performance: use hugo render hook for Mermaid

Open stephanlachnit opened this issue 3 years ago • 0 comments

This switches Mermaid to use hugo's Markdown render hooks instead of manipulating the string at runtime, which should improve page loading performance by a tiny bit.

Similar to #987, can probably also be done for PlantUML and MarkMap.

This could potentially improved even further by setting {{ .Page.Store.Set "hasXXX" true }} in render-codeblock-XXX.html and adjusting scripts.html so that these corresponding JavaScript functions are loaded only on that page instead of bundling them to a global script. This would also lift the requirements to set params.XXX.enable = true. However since this is a more complicated endeavor and I'm not really familiar with js, I did not attempt to do this.

stephanlachnit avatar Apr 26 '22 15:04 stephanlachnit