diff --git a/layout/_partial/head.ejs b/layout/_partial/head.ejs index 0de8099..fc2a465 100755 --- a/layout/_partial/head.ejs +++ b/layout/_partial/head.ejs @@ -62,15 +62,6 @@ function og_args() { <%- generate_title() %> - <% if (theme.heti) { %> - - - - <% } %> - <% if (theme.open_graph && theme.open_graph.enable) { %> <%- open_graph(og_args()) %> <% } %> diff --git a/source/js/main.js b/source/js/main.js index 46aed77..3158927 100644 --- a/source/js/main.js +++ b/source/js/main.js @@ -301,8 +301,22 @@ if (stellar.plugins.fancybox) { 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(); + const heti = new Heti('.heti'); + + // Copied from heti.autoSpacing() without DOMContentLoaded. + // https://github.com/sivan/heti/blob/eadee6a3b748b3b7924a9e7d5b395d4bce479c9a/js/heti-addon.js + // + // We managed to minimize the code modification to ensure .autoSpacing() + // is synced with upstream; therefore, we use `.bind()` to emulate the + // behavior of .autoSpacing() so we can even modify almost no code. + void (function () { + const $$rootList = document.querySelectorAll(this.rootSelector) + + for (let $$root of $$rootList) { + this.spacingElement($$root) + } + }).bind(heti)(); + stellar.plugins.heti.enable = false; }); }