Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gitbook-plugin-search

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gitbook-plugin-search - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

22

index.js

@@ -31,12 +31,11 @@ var lunr = require('lunr');

"page": function(page) {
if (this.options.generator != 'website' || !searchIndexEnabled) return page;
var maxIndexSize = this.config.get('pluginsConfig.search.maxIndexSize') || this.config.get('search.maxIndexSize')
if (this.output.name != 'website' || !searchIndexEnabled) return page;
var text, maxIndexSize;
maxIndexSize = this.config.get('pluginsConfig.search.maxIndexSize') || this.config.get('search.maxIndexSize');
this.log.debug.ln('index page', page.path);
// Extract HTML
var html = _.pluck(page.sections, 'content').join(' ');
// Transform as TEXT
var text = html.replace(/(<([^>]+)>)/ig, '');
text = page.content.replace(/(<([^>]+)>)/ig, '');

@@ -52,4 +51,4 @@ indexSize = indexSize + text.length;

searchIndex.add({
url: this.contentLink(page.path),
title: page.progress.current.title,
url: this.output.toURL(page.path),
title: page.title,
body: text

@@ -63,9 +62,6 @@ });

"finish": function() {
if (this.options.generator != 'website') return;
if (this.output.name != 'website') return;
this.log.debug.ln('write search index');
fs.writeFileSync(
path.join(this.options.output, "search_index.json"),
JSON.stringify(searchIndex)
);
return this.output.writeFile('search_index.json', JSON.stringify(searchIndex));
}

@@ -72,0 +68,0 @@ }

@@ -5,5 +5,5 @@ {

"main": "index.js",
"version": "1.1.0",
"version": "1.2.0",
"engines": {
"gitbook": ">=2.5.0"
"gitbook": ">=3.0.0-pre.0"
},

@@ -10,0 +10,0 @@ "dependencies": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc