feat: mermaid

This commit is contained in:
shenyu 2021-04-14 11:26:09 +08:00
parent c61cbb4803
commit ed96a4ac21
3 changed files with 80 additions and 91 deletions

View File

@ -157,11 +157,10 @@ katex:
allpost: true allpost: true
copy_tex: false copy_tex: false
# mermaid 三个选项缺一不可 # mermaid流程图 三个选项缺一不可(https://mermaid-js.github.io/mermaid/)
mermaid: mermaid:
enable: true enable: false
version: 8.5.2 cdn: https://cdn.jsdelivr.net/npm/mermaid@8.9.2/dist/mermaid.min.js
cdn: https://cdn.bootcdn.net/ajax/libs/mermaid
theme: forest theme: forest
# 网站成立年份(默认为 2019若填入年份小于当前年份则显示为 2018-2019 类似的格式) # 网站成立年份(默认为 2019若填入年份小于当前年份则显示为 2018-2019 类似的格式)

View File

@ -1,75 +1,57 @@
<%- js('/js/jquery-2.0.3.min') %> <%- js('/js/jquery-2.0.3.min') %> <%- js('/js/lazyload.min') %>
<%- js('/js/lazyload.min') %>
<!-- Tocbot --> <!-- Tocbot -->
<% if (theme.toc && is_post() && !page.no_toc){ %> <% if (theme.toc && is_post() && !page.no_toc){ %> <%- js('/js/tocbot.min') %>
<%- js('/js/tocbot.min') %>
<script> <script>
tocbot.init({ tocbot.init({
tocSelector: '.tocbot', tocSelector: ".tocbot",
contentSelector: '.article-entry', contentSelector: ".article-entry",
headingSelector: 'h1, h2, h3, h4, h5, h6', headingSelector: "h1, h2, h3, h4, h5, h6",
hasInnerContainers: true, hasInnerContainers: true,
scrollSmooth: true, scrollSmooth: true,
scrollContainer: 'main', scrollContainer: "main",
positionFixedSelector: '.tocbot', positionFixedSelector: ".tocbot",
positionFixedClass: 'is-position-fixed', positionFixedClass: "is-position-fixed",
fixedSidebarOffset: 'auto' fixedSidebarOffset: "auto",
}); });
</script> </script>
<% } %> <% } %>
<script src="https://cdn.jsdelivr.net/npm/jquery-modal@0.9.2/jquery.modal.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/jquery-modal@0.9.2/jquery.modal.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/jquery-modal@0.9.2/jquery.modal.min.css"> <link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/jquery-modal@0.9.2/jquery.modal.min.css"
/>
<script src="https://cdn.jsdelivr.net/npm/justifiedGallery@3.7.0/dist/js/jquery.justifiedGallery.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/justifiedGallery@3.7.0/dist/js/jquery.justifiedGallery.min.js"></script>
<%- js('dist/main') %> <%- js('dist/main') %>
<!-- ImageViewer --> <!-- ImageViewer -->
<% if (theme.image_viewer){ %> <% if (theme.image_viewer){ %> <%- partial('viewer') %> <% } %>
<%- partial('viewer') %>
<% } %>
<!-- MathJax --> <!-- MathJax -->
<% if (theme.mathjax){ %> <% if (theme.mathjax){ %> <%- partial('mathjax') %>
<%- partial('mathjax') %>
<script> <script>
var ayerConfig = { var ayerConfig = {
mathjax: true mathjax: true,
} };
</script> </script>
<% } %> <% } %>
<!-- Katex --> <!-- Katex -->
<% if (theme.katex.enable){ %> <% if (theme.katex.enable){ %> <%- partial('katex') %> <% } %>
<%- partial('katex') %>
<% } %>
<!-- busuanzi --> <!-- busuanzi -->
<% if (theme.busuanzi && theme.busuanzi.enable){ %> <% if (theme.busuanzi && theme.busuanzi.enable){ %> <%-
<%- js('/js/busuanzi-2.3.pure.min') %> js('/js/busuanzi-2.3.pure.min') %> <% } %>
<% } %>
<!-- ClickLove --> <!-- ClickLove -->
<% if (theme.click_effect===1){ %> <% if (theme.click_effect===1){ %> <%- js('/js/clickLove') %> <% } %>
<%- js('/js/clickLove') %>
<% } %>
<!-- ClickBoom1 --> <!-- ClickBoom1 -->
<% if (theme.click_effect===2){ %> <% if (theme.click_effect===2){ %>
<script src="https://cdn.jsdelivr.net/npm/animejs@latest/anime.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/animejs@latest/anime.min.js"></script>
<%- js('/js/clickBoom1') %> <%- js('/js/clickBoom1') %> <% } %>
<% } %>
<!-- ClickBoom2 --> <!-- ClickBoom2 -->
<% if (theme.click_effect===3){ %> <% if (theme.click_effect===3){ %> <%- js('/js/clickBoom2') %> <% } %>
<%- js('/js/clickBoom2') %>
<% } %>
<!-- CodeCopy --> <!-- CodeCopy -->
<% if (theme.copy_btn == true) { %> <% if (theme.copy_btn == true) { %> <%- css('/css/clipboard') %> <%-
<%- css('/css/clipboard') %> partial('post/clipboard') %> <% } %>
<%- partial('post/clipboard') %>
<% } %>
<!-- CanvasBackground --> <!-- CanvasBackground -->
<% if (theme.canvas_bg == 1) { %> <% if (theme.canvas_bg == 1) { %> <%- js('/js/dz') %> <% } %>
<%- js('/js/dz') %> <script>
<% } %> if (window.mermaid) {
<!-- mermaid --> mermaid.initialize({ theme: "<%= theme.mermaid.theme %>" });
<% if (theme.mermaid.enable) { %> }
<script src='<%= theme.mermaid.cdn %>/<%= theme.mermaid.version %>/mermaid.min.js'></script> </script>
<script>
if (window.mermaid) {
mermaid.initialize({theme: '<%= theme.mermaid.theme %>'});
}
</script>
<% } %>

View File

@ -2,40 +2,48 @@
<% if (config.language){ %> <% if (config.language){ %>
<html lang="<%= config.language %>"> <html lang="<%= config.language %>">
<% } else { %> <% } else { %>
<html lang="en"> <html lang="en">
<% }%> <% }%>
<head>
<meta charset="utf-8" />
<% var title = page.title; if (is_archive()) { title = __('archive_a'); if
(is_month()) { title += ': ' + page.year + '/' + page.month; } else if
(is_year()) { title += ': ' + page.year; } } else if (is_category()) { title
= page.category; } else if (is_tag()) {
title = __('tag') + ': ' + page.tag; } %> <% if (page.keywords){ %>
<meta name="keywords" content="<%= page.keywords %>,<%= config.keywords %>" />
<% } else if (config.keywords){ %>
<meta name="keywords" content="<%= config.keywords %>" />
<% } %> <% if (page.description){ %>
<meta name="description" content="<%= page.description %>" />
<% } else if (config.description){ %>
<meta name="description" content="<%= config.description %>" />
<% } %>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<title>
<% if (title){ %><%= title %> | <% } %> <%= config.title %>
</title>
<% if (theme.favicon){ %>
<link rel="shortcut icon" href="<%- theme.favicon %>" />
<% } %>
<%- css('dist/main') %>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Shen-Yu/cdn/css/remixicon.min.css">
<%- css('css/custom') %>
<% if (theme.progressBar){ %>
<script src="https://cdn.jsdelivr.net/npm/pace-js@1.0.2/pace.min.js"></script>
<% } %>
<%- partial('google-analytics') %>
<%- partial('baidu-analytics') %>
</head>
<head>
<meta charset="utf-8" />
<% var title = page.title; if (is_archive()) { title = __('archive_a'); if
(is_month()) { title += ': ' + page.year + '/' + page.month; } else if
(is_year()) { title += ': ' + page.year; } } else if (is_category()) {
title = page.category; } else if (is_tag()) { title = __('tag') + ': ' +
page.tag; } %> <% if (page.keywords){ %>
<meta
name="keywords"
content="<%= page.keywords %>,<%= config.keywords %>"
/>
<% } else if (config.keywords){ %>
<meta name="keywords" content="<%= config.keywords %>" />
<% } %> <% if (page.description){ %>
<meta name="description" content="<%= page.description %>" />
<% } else if (config.description){ %>
<meta name="description" content="<%= config.description %>" />
<% } %>
<meta
name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1"
/>
<title><% if (title){ %><%= title %> | <% } %> <%= config.title %></title>
<% if (theme.favicon){ %>
<link rel="shortcut icon" href="<%- theme.favicon %>" />
<% } %> <%- css('dist/main') %>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/gh/Shen-Yu/cdn/css/remixicon.min.css"
/>
<%- css('css/custom') %> <% if (theme.progressBar){ %>
<script src="https://cdn.jsdelivr.net/npm/pace-js@1.0.2/pace.min.js"></script>
<% } %> <%- partial('google-analytics') %> <%- partial('baidu-analytics')
%>
<!-- mermaid -->
<% if (theme.mermaid.enable) { %>
<script src="<%= theme.mermaid.cdn %>"></script>
<% } %>
</head>
</html>
</html> </html>