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 类似的格式)
@ -235,7 +234,7 @@ twikoo:
minivaline: minivaline:
enable: false enable: false
md: true md: true
# 更多选项 https://minivaline.js.org/docs/cn/#/Options 按照yml格式继续填写即可 (除了 [el] 选项) # 更多选项 https://minivaline.js.org/docs/cn/#/Options 按照yml格式继续填写即可 (除了 [el] 选项)
# emoticonUrl 等列表选项 可参考 https://github.com/MiniValine/hexo-next-minivaline # emoticonUrl 等列表选项 可参考 https://github.com/MiniValine/hexo-next-minivaline
# 下面是一个例子: # 下面是一个例子:
backend: waline backend: waline
@ -253,4 +252,4 @@ ads:
title: 云服务器全球购低至2折 title: 云服务器全球购低至2折
img: https://cdn.jsdelivr.net/gh/Shen-Yu/cdn/img/ten_2.jpg img: https://cdn.jsdelivr.net/gh/Shen-Yu/cdn/img/ten_2.jpg
url: https://curl.qcloud.com/kvO7hb43 url: https://curl.qcloud.com/kvO7hb43
width: 300 width: 300

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