diff --git a/themes/chameleon/scripts/heading-link.js b/themes/chameleon/scripts/heading-link.js index 107d0b0..675de8a 100644 --- a/themes/chameleon/scripts/heading-link.js +++ b/themes/chameleon/scripts/heading-link.js @@ -9,16 +9,16 @@ const { slugize, stripHTML, unescapeHTML: unescape } = require('hexo-util') const anchorId = (str, transformOption) => { - return slugize(stripHTML(unescape(str)).trim(), { transform: transformOption }); + return slugize(stripHTML(unescape(str)).trim(), { transform: transformOption }) } hexo.extend.filter.register('marked:renderer', function (renderer) { const { config } = this + const headingId = {} renderer.heading = function (text, level) { const { modifyAnchors } = config.marked - const transformOption = modifyAnchors; + const transformOption = modifyAnchors let id = anchorId(text, transformOption) - const headingId = {}; // Add a number after id if repeated if (headingId[id]) {