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.0.2 to 1.1.0

13

index.js

@@ -14,2 +14,5 @@ var lunr = require('lunr');

var searchIndexEnabled = true;
var indexSize = 0;
module.exports = {

@@ -29,3 +32,4 @@ book: {

"page": function(page) {
if (this.options.generator != 'website') return page;
if (this.options.generator != 'website' || !searchIndexEnabled) return page;
var maxIndexSize = this.config.get('pluginsConfig.search.maxIndexSize') || this.config.get('search.maxIndexSize')

@@ -40,2 +44,9 @@ this.log.debug.ln('index page', page.path);

indexSize = indexSize + text.length;
if (indexSize > maxIndexSize) {
this.log.warn.ln("search index is too big, indexing is now disabled");
searchIndexEnabled = false;
return page;
}
// Add to index

@@ -42,0 +53,0 @@ searchIndex.add({

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

"main": "index.js",
"version": "1.0.2",
"version": "1.1.0",
"engines": {
"gitbook": ">=2.4.0"
"gitbook": ">=2.5.0"
},

@@ -28,3 +28,12 @@ "dependencies": {

"prepublish": "cp node_modules/lunr/lunr.min.js ./assets/lunr.min.js;lessc ./less/search.less > ./assets/search.css"
},
"gitbook": {
"properties": {
"maxIndexSize": {
"type": "number",
"title": "Limit size for the index",
"default": 1000000
}
}
}
}
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