gitbook-plugin-lunr

Index book in a lunr index accessible from the search plugin

Apache-2.0 9 个版本
安装
npm install gitbook-plugin-lunr
yarn add gitbook-plugin-lunr
pnpm add gitbook-plugin-lunr
bun add gitbook-plugin-lunr
README

lunr

This plugin provides a backend for the search plugin.

This plugin is a default plugin.

Disable this plugin

This is a default plugin and it can be disabled using a book.json configuration:

{
    "plugins": ["-lunr"]
}

Limitations

Lunr can't index a huge book, by default the index size is limited at ~100ko.

You can change this limit by settings the configuration maxIndexSize:

{
    "pluginsConfig": {
        "lunr": {
            "maxIndexSize": 200000
        }
    }
}

Adding keywords to a page

You can specify explicit keywords for any page. When searching for these keywords, the page will rank higher in the results.

---
search:
    keywords: ['keyword1', 'keyword2', 'etc.']

---

# My Page

This page will rank better if we search for 'keyword1'.

Disabling indexing of a page

You can disable the indexing of a specific page by adding a YAML header to the page:

---
search: false
---

# My Page

This page is not indexed in Lunr.

Ignoring special characters

By default, special characters will be taken into account, to allow special searches like "C++" or "#word". You can disable this if your text is essentially English prose with the ignoreSpecialCharacters option:

{
    "pluginsConfig": {
        "lunr": {
            "ignoreSpecialCharacters": true
        }
    }
}
版本列表
4.0.0-alpha.6 2017-03-16
4.0.0-alpha.5 2017-03-09
4.0.0-alpha.4 2017-01-27
4.0.0-alpha.3 2017-01-13
4.0.0-alpha.2 2017-01-13
4.0.0-alpha.1 2017-01-13
1.2.0 2016-07-01
1.1.0 2016-04-15
1.0.0 2016-04-14