How to use the hexo-util.stripHTML function in hexo-util

To help you get started, we’ve selected a few hexo-util examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hexojs / hexo-renderer-marked / lib / renderer.js View on Github external
heading(text, level) {
    if (!this.options.headerIds) {
      return `${text}`;
    }
    const transformOption = this.options.modifyAnchors;
    let id = anchorId(stripHTML(text), transformOption);
    const headingId = this._headingId;

    // Add a number after id if repeated
    if (headingId[id]) {
      id += `-${headingId[id]++}`;
    } else {
      headingId[id] = 1;
    }

    // add headerlink
    return `<a title="${stripHTML(text)}" class="headerlink" href="#${id}"></a>${text}`;
  }
github ikeq / hexo-theme-inside / lib / generator / entries / search.js View on Github external
.map(post =&gt; {
          const ret = pick(post, searchProps)
          ret.content = stripHTML(
            ret.content
              .replace(//g, '')
              .replace(//g, '')
          )

          return ret
        })
    }) : [],
github webhintio / webhint.io / src / webhint-theme / scripts / custom-renderer.js View on Github external
renderer.heading = (text, level) =&gt; {
    const id = uslug(stripHTML(text));

    return `${text}<a title="${stripHTML(text)}" class="headerlink" href="#${id}"></a>`;
};
github alexbruno / hexo-generator-json-content / src / modules / utils.js View on Github external
export function minify (str) {
  return stripHTML(str).trim().replace(/\s+/g, ' ')
}
github ppoffice / hexo-theme-minos / scripts / 10_i18n.js View on Github external
function minify(str) {
        return util.stripHTML(str).trim().replace(/\n/g, ' ').replace(/\s+/g, ' ');
    }
    function postMapper(post) {
github theme-next / hexo-symbols-count-time / index.js View on Github external
hexo.extend.filter.register('after_post_render', function(data) {
    var content = data.content;
    if (config.exclude_codeblock) content = content.replace(/<pre>.*?&lt;\/pre&gt;/g, '');
    data.length = stripHTML(content).replace(/\r?\n|\r/g, '').replace(/\s+/g, '').length;
  }, 0);
}</pre>
github alexbruno / hexo-generator-json-content / index.js View on Github external
	minify = str => util.stripHTML(str).trim().replace(/\n/g, ' ').replace(/\s+/g, ' '),
	getProps = ref => Object.getOwnPropertyNames(ref).filter(item => ref[item]),
github ppoffice / hexo-theme-icarus / includes / generators / insight.js View on Github external
function minify(str) {
            return util.stripHTML(str).trim().replace(/\n/g, ' ').replace(/\s+/g, ' ')
                .replace(/&#x([\da-fA-F]+);/g, function (match, hex) {
                    return String.fromCharCode(parseInt(hex, 16));
                })
                .replace(/&#([\d]+);/g, function (match, dec) {
                    return String.fromCharCode(dec);
                });
        }
        function postMapper(post) {