Skip to content

Commit c013249

Browse files
committed
feat: Add Mermaid.js integration to enable diagram rendering in blog posts.
1 parent 7e8c138 commit c013249

2 files changed

Lines changed: 40 additions & 0 deletions

File tree

_includes/mermaid.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<script src="https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.min.js"></script>
2+
<script>
3+
document.addEventListener("DOMContentLoaded", function() {
4+
mermaid.initialize({
5+
startOnLoad: true,
6+
theme: 'default',
7+
flowchart: { useMaxWidth: true }
8+
});
9+
});
10+
</script>

_layouts/post.html

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
layout: default
3+
---
4+
<article class="post h-entry" itemscope itemtype="http://schema.org/BlogPosting">
5+
6+
<header class="post-header">
7+
<h1 class="post-title p-name" itemprop="name headline">{{ page.title | escape }}</h1>
8+
<p class="post-meta">
9+
<time class="dt-published" datetime="{{ page.date | date_to_xmlschema }}" itemprop="datePublished">
10+
{{ page.date | date: "%Y-%m-%d" }}
11+
</time>
12+
{%- if page.author -%}
13+
<span itemprop="author" itemscope itemtype="http://schema.org/Person"><span class="p-author h-card"
14+
itemprop="name">{{ page.author | escape }}</span></span>
15+
{%- endif -%}
16+
</p>
17+
</header>
18+
19+
<div class="post-content e-content" itemprop="articleBody">
20+
{{ content }}
21+
</div>
22+
23+
{%- if site.disqus.shortname -%}
24+
{%- include disqus_comments.html -%}
25+
{%- endif -%}
26+
27+
<a class="u-url" href="{{ page.url | relative_url }}" hidden></a>
28+
</article>
29+
30+
{% include mermaid.html %}

0 commit comments

Comments
 (0)