Skip to content

Commit

Permalink
Updated: mermaid id
Browse files Browse the repository at this point in the history
  • Loading branch information
upupming committed Nov 12, 2018
1 parent 705c4e3 commit 9f26670
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules/
package-lock.json
.notes
.notes
test*
12 changes: 3 additions & 9 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,8 @@
<div id="app"></div>
<script src="//cdn.jsdelivr.net/npm/[email protected]/dist/mermaid.min.js"></script>
<script>
function makeid(len) {
var text = new Array(len);
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
for (var i = 0; i < len; i++) text[i] = possible.charAt(Math.floor(Math.random() * possible.length));
return text.join("");
}
mermaid.initialize({ startOnLoad: false });
let id = 0;
window.$docsify = {
name: 'docsify-katex',
repo: 'https://github.com/upupming/docsify-katex',
Expand All @@ -31,9 +26,8 @@
renderer: {
code: function(code, lang) {
if (lang === "mermaid") {
let id = makeid(10);
return (
'<div class="mermaid">' + mermaid.render(id, code) + "</div>"
'<div class="mermaid">' + mermaid.render('mermaid-svg-' + id++, code) + "</div>"
);
}
return this.origin.code.apply(this, arguments);
Expand All @@ -42,7 +36,7 @@
}
}
</script>
<script src="../dist/docsify-katex.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify-katex@latest/dist/docsify-katex.js"></script>
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/katex@latest/dist/katex.min.css">
<script src="//cdn.jsdelivr.net/npm/docsify@latest/lib/docsify.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify@latest/lib/plugins/search.min.js"></script>
Expand Down

0 comments on commit 9f26670

Please sign in to comment.