Skip to content

Commit

Permalink
docs: try mermaid-gitbook example
Browse files Browse the repository at this point in the history
  • Loading branch information
roggervalf committed Mar 7, 2022
1 parent 14a4099 commit dc5c396
Show file tree
Hide file tree
Showing 5 changed files with 616 additions and 116 deletions.
7 changes: 4 additions & 3 deletions book.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"plugins": ["mermaid-compat"],
"plugins": ["addcssjs", "richquotes"],
"pluginsConfig": {
"mermaid-compat": {
"theme": "forest"
"addcssjs": {
"js": ["./mermaid/mermaid.min.js", "./mermaid/index.js"],
"css": []
}
}
}
16 changes: 16 additions & 0 deletions mermaid/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
let path = null;

setInterval(() => {
if (path !== window.location.pathname) {
path = window.location.pathname;
document.querySelectorAll('.lang-mermaid').forEach(node => {
const newNode = node.cloneNode(true);
newNode.removeAttribute('class');
const hr = document.createElement('hr');
node.parentNode.insertBefore(hr, node);
node.parentNode.insertBefore(newNode, hr);
});
window.mermaid.initialize({ theme: 'default' });
window.mermaid.init(undefined, document.querySelectorAll('.lang-mermaid'));
}
}, 1000);
6 changes: 6 additions & 0 deletions mermaid/mermaid.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,10 @@
"eslint-plugin-prettier": "3.1.2",
"eslint-plugin-promise": "4.2.1",
"eslint-plugin-tsdoc": "^0.2.14",
"gitbook-plugin-mermaid-compat": "^0.2.0-beta1",
"husky": "^3.1.0",
"istanbul": "^0.4.5",
"lint-staged": "10.5.4",
"mermaid": "^8.14.0",
"mocha": "^6.2.3",
"mocha-lcov-reporter": "^1.3.0",
"npm-run-all": "^4.1.5",
Expand Down
Loading

0 comments on commit dc5c396

Please sign in to comment.