docsy
docsy copied to clipboard
performance: use hugo render hook for Mermaid
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.