Skip to content

Commit e066bfc

Browse files
committed
Update mermaid.html
1 parent 5ce26f7 commit e066bfc

1 file changed

Lines changed: 22 additions & 3 deletions

File tree

_includes/scripts/mermaid.html

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
11
{% if site.enable_mermaid %}
22
<!-- Mermaid.js for diagrams in markdown -->
33
<style>
4-
.mermaid-wrapper { max-width: 100%; overflow-x: auto; overflow-y: visible; margin: 1rem 0; }
5-
.mermaid-wrapper .mermaid { display: flex; justify-content: center; }
6-
.mermaid-wrapper .mermaid svg { max-width: 100%; height: auto; }
4+
.mermaid-wrapper {
5+
width: 100%;
6+
max-width: 100%;
7+
min-width: 0;
8+
overflow-x: auto;
9+
overflow-y: visible;
10+
margin: 1rem 0;
11+
}
12+
.mermaid-wrapper .mermaid {
13+
min-width: 0;
14+
}
15+
.mermaid-wrapper .mermaid svg {
16+
max-width: 100% !important;
17+
width: 100% !important;
18+
height: auto !important;
19+
}
720
</style>
821
<script src="https://cdn.jsdelivr.net/npm/mermaid@{{ site.mermaid.version }}/dist/mermaid.min.js" crossorigin="anonymous"></script>
922
<script>
@@ -29,6 +42,12 @@
2942
pre.style.display = 'none';
3043
});
3144
mermaid.run({ querySelector: '.mermaid', suppressErrors: true });
45+
setTimeout(function () {
46+
document.querySelectorAll('.mermaid-wrapper svg').forEach(function (svg) {
47+
svg.removeAttribute('width');
48+
svg.removeAttribute('height');
49+
});
50+
}, 100);
3251
});
3352
</script>
3453
{% endif %}

0 commit comments

Comments
 (0)