diff --git a/lib/plugins/helper/toc.js b/lib/plugins/helper/toc.js index ddf4023816..3601588284 100644 --- a/lib/plugins/helper/toc.js +++ b/lib/plugins/helper/toc.js @@ -1,7 +1,7 @@ 'use strict'; let cheerio; -const escape = require('lodash/escape'); +const { escapeHTML } = require('hexo-util'); function tocHelper(str, options = {}) { if (!cheerio) cheerio = require('cheerio'); @@ -31,7 +31,7 @@ function tocHelper(str, options = {}) { headings.each(function() { const level = +this.name[1]; const id = getId(this); - const text = escape($(this).text()); + const text = escapeHTML($(this).text()); lastNumber[level - 1]++;