Skip to content

Commit 840e074

Browse files
committed
Implementing Mermaid support as an include and changing config for local testing
1 parent dda1fc5 commit 840e074

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

_config.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
title: OS²Product
44
55
description: The Jekyll version of the Spectral theme by HTML5 UP.
6-
#baseurl: ""
7-
#url: "http://localhost:4000"
6+
baseurl: ""
7+
url: "http://localhost:4000"
88

99
# Uncomment the lines below if you are deploying to GitHub Pages
10-
baseurl: "/spectral-jekyll-theme"
11-
url: "https://janhalen.github.io"
10+
# baseurl: "/spectral-jekyll-theme"
11+
# url: "https://janhalen.github.io"
1212

1313
# Homepage tiles
1414
tiles-source: posts # accepts "posts" or "pages"

_includes/mermaid-init.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.min.js
2+
<script>
3+
document.addEventListener("DOMContentLoaded", function () {
4+
const blocks = document.querySelectorAll("pre code.language-mermaid");
5+
blocks.forEach(block => {
6+
const container = document.createElement("div");
7+
container.className = "mermaid";
8+
container.textContent = block.textContent;
9+
block.parentElement.replaceWith(container);
10+
});
11+
mermaid.initialize({ startOnLoad: true });
12+
});
13+
</script>

_layouts/default.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
{% include section-three.html %}
1616
{% include cta.html %}
1717
{% include footer.html %}
18+
{% include mermaid-init.html %}
1819
</body>
1920

2021
</html>

0 commit comments

Comments
 (0)