Skip to content

Commit

Permalink
Merge pull request #8731 from voughtdq/load-mermaid-asynchronously/OT…
Browse files Browse the repository at this point in the history
…P-19197

Load mermaid asynchronously in docs
  • Loading branch information
garazdawi authored Aug 20, 2024
2 parents 6787b52 + 04fd4e9 commit 2148554
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions make/ex_doc.exs
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,8 @@ config = [
before_closing_body_tag: fn
:html ->
"""
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/mermaid.min.js"></script>
<script>
document.addEventListener("DOMContentLoaded", function () {
function mermaidLoaded() {
mermaid.initialize({
startOnLoad: false,
theme: document.body.className.includes("dark") ? "dark" : "default"
Expand All @@ -217,8 +216,9 @@ config = [
preEl.remove();
});
}
});
}
</script>
<script async src="https://cdn.jsdelivr.net/npm/[email protected]/dist/mermaid.min.js" onload="mermaidLoaded();"></script>
"""

_ ->
Expand Down

0 comments on commit 2148554

Please sign in to comment.