diff --git a/_config.yml b/_config.yml index 8497d2b..b39dcb2 100755 --- a/_config.yml +++ b/_config.yml @@ -248,11 +248,11 @@ plugins: enable: true css: https://unpkg.com/swiper@6/swiper-bundle.min.css js: https://unpkg.com/swiper@6/swiper-bundle.min.js - - + + # 赫蹏 (Heti) - 专为中文网页内容设计的排版样式增强 # https://github.com/sivan/heti - heti: + heti: enable: false css: https://unpkg.com/heti/umd/heti.min.css js: https://unpkg.com/heti/umd/heti-addon.min.js diff --git a/layout/_partial/main/post_list/post_card.ejs b/layout/_partial/main/post_list/post_card.ejs index a6bbe90..285bd6f 100755 --- a/layout/_partial/main/post_list/post_card.ejs +++ b/layout/_partial/main/post_list/post_card.ejs @@ -40,7 +40,11 @@ function div_default() { el += ''; // 摘要 - el += '
'; + el += '
'; el += '

'; if (post.excerpt) { el += strip_html(post.excerpt); diff --git a/layout/_partial/scripts/index.ejs b/layout/_partial/scripts/index.ejs index 2f71e2d..77733d6 100644 --- a/layout/_partial/scripts/index.ejs +++ b/layout/_partial/scripts/index.ejs @@ -124,6 +124,9 @@ if ('<%- theme.plugins.fancybox.enable %>' == 'true') { stellar.plugins.fancybox = Object.assign(<%- JSON.stringify(theme.plugins.fancybox) %>); } + if ('<%- theme.plugins.heti.enable %>' == 'true') { + stellar.plugins.heti = Object.assign(<%- JSON.stringify(theme.plugins.heti) %>); + } diff --git a/layout/post.ejs b/layout/post.ejs index e1ddffd..43c5270 100755 --- a/layout/post.ejs +++ b/layout/post.ejs @@ -13,10 +13,14 @@ function layoutTitle() { return ''; } } +let post = page; +let heti = ''; +if (theme.plugins.heti && theme.plugins.heti.enable) { + heti = ' heti'; +} %> -<% let post = page; %> <%- partial('_partial/main/navbar/breadcrumb') %> -

<%- scrollreveal() %>'> +
<%- scrollreveal() %>'> <%- layoutTitle() %> <%- post.content %> <%- partial('_partial/main/article/article_footer') %> diff --git a/source/js/main.js b/source/js/main.js index 721cb4b..46aed77 100644 --- a/source/js/main.js +++ b/source/js/main.js @@ -296,3 +296,13 @@ if (stellar.plugins.fancybox) { }) } } + +// heti +if (stellar.plugins.heti) { + stellar.loadCSS(stellar.plugins.heti.css); + stellar.loadScript(stellar.plugins.heti.js, { defer: true }).then(function () { + const heti = new Heti('.heti p'); + heti.autoSpacing(); + stellar.plugins.heti.enable = false; + }); +}