From aad4bf26e19c4f8b7c635128311325aa30523440 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Weber?= Date: Sun, 13 Sep 2020 11:49:31 +0200 Subject: [PATCH] Change mermaid initialization to support code fences #6 --- layouts/partials/footer.html | 4 +++- static/js/hugo-relearn.js | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 28f48c13f3..7d4c599fbc 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -75,7 +75,9 @@ {{ end }} {{ end }} {{ partial "custom-footer.html" . }} diff --git a/static/js/hugo-relearn.js b/static/js/hugo-relearn.js index 9fab8ded64..26c75f93fc 100644 --- a/static/js/hugo-relearn.js +++ b/static/js/hugo-relearn.js @@ -87,8 +87,12 @@ jQuery(document).ready(function() { e.clearSelection(); $(e.trigger).attr('aria-label', 'Link copied to clipboard!').addClass('tooltipped tooltipped-s'); }); + $('code.language-mermaid').each(function(index, element) { var content = $(element).html().replace(/&/g, '&'); $(element).parent().replaceWith('
' + content + '
'); }); + if (mermaid) { + mermaid.init(undefined, $('.mermaid')); + } });