Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions templates/book-section.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@

{% block head_extensions %}
<script src="/optional-helpers.js"></script>
<!-- When this javascript is loaded and initialized it will look for divs with the class `mermaid`
it will replace the content of those divs with the generated mermaid content-->
<script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't be pulling from a cdn here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have a suggestion for a better solution?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to use a local version of mermaid instead of fetching from cdn

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't block page paint on mermaid loading and being parsed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've removed the block-on-load

<script>mermaid.initialize({startOnLoad:true, theme: 'dark'});</script>
{% endblock %}

{% block content %}
Expand Down
3 changes: 3 additions & 0 deletions templates/shortcodes/mermaid.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div class="mermaid">
{{ body }}
</div>