From 3e690c8402e523e97ccd7ac532f6076ae05e5f29 Mon Sep 17 00:00:00 2001 From: Nikola Petrov Date: Wed, 10 Jul 2024 00:10:49 +0300 Subject: [PATCH 1/2] Add mermaid diagrams support through javascript This is the best option that I could find for this. Another way would be to shellout to the `mermaid-cli` but that seems too heavyweight and needs yet another cli to be installed on the machine. Where the pure javascript library is just portable. What this does is that it reverses the highlighting done github API and then it runs the mermaid javascript library on top of the pre tags that are created. The only downside that I can see is that there is now a dependency on the mermaid javascript library in the template. There might be ways to get around this by loading the file dynamically but that seems far too complex for my taste. --- grip/templates/index.html | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/grip/templates/index.html b/grip/templates/index.html index 14d54de..80c9d64 100644 --- a/grip/templates/index.html +++ b/grip/templates/index.html @@ -33,7 +33,8 @@ {%- endblock -%} {%- block scripts -%} -