/* global hexo */ 'use strict'; hexo.extend.generator.register('_hexo_generator_search', function(locals) { const config = this.theme.config; if (!config.search.enable) { return; } const nunjucks = require('nunjucks'); const env = new nunjucks.Environment(); const pathFn = require('path'); const fs = require('fs'); env.addFilter('uriencode', function(str) { return encodeURI(str); }); env.addFilter('noControlChars', function(str) { // eslint-disable-next-line no-control-regex return str && str.replace(/[\x00-\x1F\x7F]/g, '').replace(/