anru / docusaurus-lunr-search

Local / Offline Search for docusaurus - Demo at

Home Page:https://lelouch77.github.io/docusaurus-lunr-search-demo/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

docusaurus-lunr-search

Offline Search for Docusaurus V2

Demo Website

MIT Licence

npm version

Sample

How to Use ?

  1. Install this package
npm i docusaurus-lunr-search  --save

  1. Then run docusaurus swizzle
npm run swizzle docusaurus-lunr-search SearchBar
  1. Add the docusaurus-lunr-search plugin to your docusaurus.config.js
const path = require('path');
module.exports = {
  // ...
    plugins: [path.resolve(__dirname, './node_modules/docusaurus-lunr-search/')],
}
  1. Then build your Docusaurus project
npm run build
  1. Serve your application
npx http-server ./build

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

Language options

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

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

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.

About

Local / Offline Search for docusaurus - Demo at

https://lelouch77.github.io/docusaurus-lunr-search-demo/

License:MIT License


Languages

Language:JavaScript 68.0%Language:CSS 32.0%