mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2025-01-18 19:00:24 +00:00
Change mermaid initialization to support code fences #6
This commit is contained in:
parent
b3429ed9a3
commit
aad4bf26e1
2 changed files with 7 additions and 1 deletions
|
@ -75,7 +75,9 @@
|
|||
<script src="{{"mermaid/mermaid.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}"></script>
|
||||
{{ end }}
|
||||
<script>
|
||||
mermaid.initialize({ startOnLoad: true });
|
||||
if (mermaid) {
|
||||
mermaid.startOnLoad = false;
|
||||
}
|
||||
</script>
|
||||
{{ end }}
|
||||
{{ partial "custom-footer.html" . }}
|
||||
|
|
|
@ -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('<div class="mermaid" align="center">' + content + '</div>');
|
||||
});
|
||||
if (mermaid) {
|
||||
mermaid.init(undefined, $('.mermaid'));
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue