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

docusaurus-lunr-search

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

docusaurus-lunr-search

Offline search component for Docusaurus V2

  • 2.4.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
43K
decreased by-14.12%
Maintainers
1
Weekly downloads
 
Created
Source

Offline Search for Docusaurus V2

Demo Website

MIT Licence

npm version

Sample

image

Prerequisites

worker_thread is needed, suggested node version > 12.X For older version of node use docusaurus-lunr-search version 2.1.0 (npm i docusaurus-lunr-search@2.1.0)

How to Use ?

  1. Install this package
npm i docusaurus-lunr-search  --save
  1. Then run npm install to update, build, and link the packages
npm install
  1. Add the docusaurus-lunr-search plugin to your docusaurus.config.js
module.exports = {
  // ...
    plugins: [require.resolve('docusaurus-lunr-search')],
}
  1. Then build your Docusaurus project
npm run build
  1. Serve your application
npm run serve 

or

npx http-server ./build

Note: Docusaurus search information can only be generated from a production build. Local development is currently not supported.

Using an option (eg. languages) in the plugin

module.exports = {
  // ...
    plugins: [[ require.resolve('docusaurus-lunr-search'), {
      languages: ['en', 'de'] // language codes
    }]],
}

Supports all the language listed here https://github.com/MihaiValentin/lunr-languages

Options available

OptionTypeDefaultDescription
languagesArray['en']Language codes to use for stemming, Supports all the language listed here https://github.com/MihaiValentin/lunr-languages
indexBaseUrlBooleanfalseBase url will not indexed by default, if you want to index the base url set this option to true
excludeRoutesArray[]Exclude certain routes from the search
includeRoutesArray[]Include only specific routes for search
stopWordsArray[]Add stop words(words that are exclude from search result) to the search index
excludeTagsArray[]Exclude certain tags from the search
disableVersioningBooleanfalseDocs versions are displayed by default. If you want to hide it, set this plugin option to true

Using FrontMatter

By default the library will search for heading only in the children of .markdown element. If you are using a FrontMatter and you have headings that are encapsulated by other elements, such as divs, then add the attribute data-search-children to the elements having headings.

Check this issue #115 for more detail

Thanks to algolia/docsearch.js, I modified it to create this search component

And thanks cmfcmf, I used the code from his library docusaurus-search-local for multi-language support.

Changelog

Checkout the releases page for changelog.

Keywords

FAQs

Package last updated on 02 Sep 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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