Skip to content

Commit

Permalink
feat(layout mermaid): mermaid diagrams support
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrAlpha committed Jun 15, 2021
1 parent e6dcdc0 commit 878ee0e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
10 changes: 10 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,11 @@ back_to_top: false
# 深色模式
darkmode: false

# Mermaid Diagrams
mermaid:
enable: false
options:



# ---------------------------------------------------------------
Expand Down Expand Up @@ -498,6 +503,11 @@ vendors:
css:
js:

# Mermiad Disgrams
# https://mermaid-js.github.io/
# Version 8.10.2
mermaid:

# busuanzi counter js
# https://busuanzi.ibruce.info
busuanzi:
Expand Down
2 changes: 2 additions & 0 deletions layout/_partial/scripts/index.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

<%- partial('_plugins/math/katex/source') %>

<%- partial('_plugins/mermaid/source') %>

<%- partial('_plugins/tag-plugins/fold/source') %>

<% if (page.comments && theme.comments.use) { %>
Expand Down
6 changes: 6 additions & 0 deletions layout/_plugins/mermaid/source.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<% if (theme.mermaid.enable) { %>
<script src='<%= url_for(theme.vendors.mermaid || 'https://cdn.jsdelivr.net/npm/mermaid@8.10.2/dist/mermaid.min.js') %>'></script>
<script>
mermaid.initialize(JSON.stringify('<%= theme.mermaid.options %>'));
</script>
<% } %>

0 comments on commit 878ee0e

Please sign in to comment.