Skip to content

Commit 796cd14

Browse files
authored
Merge pull request #235 from lostcontrol/fix-mermaid-rendering-1751822349081085163
Fix Mermaid diagram rendering in documentation
2 parents c4d1b97 + 81e0bb2 commit 796cd14

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

docs/_includes/head-custom.html

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@
44
document.addEventListener("DOMContentLoaded", async function() {
55
const elements = document.querySelectorAll('.language-mermaid');
66
elements.forEach(el => {
7-
const codeBlock = el.querySelector('code');
8-
if (codeBlock) {
9-
el.textContent = codeBlock.textContent;
10-
el.classList.add('mermaid');
7+
if (el.tagName === 'CODE') {
8+
const pre = el.parentElement;
9+
if (pre && pre.tagName === 'PRE') {
10+
const mermaidDiv = document.createElement('div');
11+
mermaidDiv.className = 'mermaid';
12+
mermaidDiv.textContent = el.textContent;
13+
pre.replaceWith(mermaidDiv);
14+
}
1115
}
1216
});
1317
await mermaid.run({

0 commit comments

Comments
 (0)