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
copy_tex: false
# mermaid 三个选项缺一不可
# mermaid流程图 三个选项缺一不可(https://mermaid-js.github.io/mermaid/)
mermaid:
enable: true
version: 8.5.2
cdn: https://cdn.bootcdn.net/ajax/libs/mermaid
enable: false
cdn: https://cdn.jsdelivr.net/npm/mermaid@8.9.2/dist/mermaid.min.js
theme: forest
# 网站成立年份(默认为 2019若填入年份小于当前年份则显示为 2018-2019 类似的格式)
@ -235,7 +234,7 @@ twikoo:
minivaline:
enable: false
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
# 下面是一个例子:
backend: waline
@ -253,4 +252,4 @@ ads:
title: 云服务器全球购低至2折
img: https://cdn.jsdelivr.net/gh/Shen-Yu/cdn/img/ten_2.jpg
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/lazyload.min') %>
<%- js('/js/jquery-2.0.3.min') %> <%- js('/js/lazyload.min') %>
<!-- Tocbot -->
<% if (theme.toc && is_post() && !page.no_toc){ %>
<%- js('/js/tocbot.min') %>
<% if (theme.toc && is_post() && !page.no_toc){ %> <%- js('/js/tocbot.min') %>
<script>
tocbot.init({
tocSelector: '.tocbot',
contentSelector: '.article-entry',
headingSelector: 'h1, h2, h3, h4, h5, h6',
tocSelector: ".tocbot",
contentSelector: ".article-entry",
headingSelector: "h1, h2, h3, h4, h5, h6",
hasInnerContainers: true,
scrollSmooth: true,
scrollContainer: 'main',
positionFixedSelector: '.tocbot',
positionFixedClass: 'is-position-fixed',
fixedSidebarOffset: 'auto'
scrollContainer: "main",
positionFixedSelector: ".tocbot",
positionFixedClass: "is-position-fixed",
fixedSidebarOffset: "auto",
});
</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>
<%- js('dist/main') %>
<!-- ImageViewer -->
<% if (theme.image_viewer){ %>
<%- partial('viewer') %>
<% } %>
<% if (theme.image_viewer){ %> <%- partial('viewer') %> <% } %>
<!-- MathJax -->
<% if (theme.mathjax){ %>
<%- partial('mathjax') %>
<% if (theme.mathjax){ %> <%- partial('mathjax') %>
<script>
var ayerConfig = {
mathjax: true
}
mathjax: true,
};
</script>
<% } %>
<!-- Katex -->
<% if (theme.katex.enable){ %>
<%- partial('katex') %>
<% } %>
<% if (theme.katex.enable){ %> <%- partial('katex') %> <% } %>
<!-- busuanzi -->
<% if (theme.busuanzi && theme.busuanzi.enable){ %>
<%- js('/js/busuanzi-2.3.pure.min') %>
<% } %>
<% if (theme.busuanzi && theme.busuanzi.enable){ %> <%-
js('/js/busuanzi-2.3.pure.min') %> <% } %>
<!-- ClickLove -->
<% if (theme.click_effect===1){ %>
<%- js('/js/clickLove') %>
<% } %>
<% if (theme.click_effect===1){ %> <%- js('/js/clickLove') %> <% } %>
<!-- ClickBoom1 -->
<% if (theme.click_effect===2){ %>
<script src="https://cdn.jsdelivr.net/npm/animejs@latest/anime.min.js"></script>
<%- js('/js/clickBoom1') %>
<% } %>
<%- js('/js/clickBoom1') %> <% } %>
<!-- ClickBoom2 -->
<% if (theme.click_effect===3){ %>
<%- js('/js/clickBoom2') %>
<% } %>
<% if (theme.click_effect===3){ %> <%- js('/js/clickBoom2') %> <% } %>
<!-- CodeCopy -->
<% if (theme.copy_btn == true) { %>
<%- css('/css/clipboard') %>
<%- partial('post/clipboard') %>
<% } %>
<% if (theme.copy_btn == true) { %> <%- css('/css/clipboard') %> <%-
partial('post/clipboard') %> <% } %>
<!-- CanvasBackground -->
<% if (theme.canvas_bg == 1) { %>
<%- js('/js/dz') %>
<% } %>
<!-- mermaid -->
<% if (theme.mermaid.enable) { %>
<script src='<%= theme.mermaid.cdn %>/<%= theme.mermaid.version %>/mermaid.min.js'></script>
<script>
if (window.mermaid) {
mermaid.initialize({theme: '<%= theme.mermaid.theme %>'});
}
</script>
<% } %>
<% if (theme.canvas_bg == 1) { %> <%- js('/js/dz') %> <% } %>
<script>
if (window.mermaid) {
mermaid.initialize({ theme: "<%= theme.mermaid.theme %>" });
}
</script>

View File

@ -2,40 +2,48 @@
<% if (config.language){ %>
<html lang="<%= config.language %>">
<% } else { %>
<html lang="en">
<% }%>
<% } else { %>
<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>
</html>
<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>