Skip to content

Commit

Permalink
Add minimal mermaid support
Browse files Browse the repository at this point in the history
  • Loading branch information
aigjermo committed Nov 2, 2018
1 parent 3dec3c0 commit 2988c8e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
10 changes: 10 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@
<script src="/vendor/zepto.min.js"></script>
<script src="/socket.io/socket.io.js"></script>
<script src="/vendor/highlight.min.js"></script>
<script src="/vendor/mermaid.min.js"></script>
<script>
mermaid.mermaidAPI.initialize({
startOnLoad: false,
flowChart: {
useMaxWidth: false,
htmlLabels: true,
},
});
</script>
<script src="/client.js"></script>
</body>
</html>
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"markdown-it-emoji": "^1.4.0",
"markdown-it-github-headings": "^1.0.1",
"markdown-it-task-checkbox": "^1.0.4",
"mermaid": "^8.0.0-rc.8",
"minimist": "^1.1.0",
"opn": "^5.1.0",
"request": "^2.48.0",
Expand Down
3 changes: 3 additions & 0 deletions public/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ socket.on('content', function (data) {
$('code').each(function (_, block) {
$(this).parent().addClass($(this).attr('class'))
})
$('code.language-mermaid').each(function (_, block) {
$(this).parent().html(mermaid.mermaidAPI.render('mermaid-' + _, block.innerText))
})
$('pre').each(function (_, block) {
hljs.highlightBlock(block)
})
Expand Down
1 change: 1 addition & 0 deletions public/vendor/mermaid.min.js

0 comments on commit 2988c8e

Please sign in to comment.