Gathering detailed insights and metrics for @cmfcmf/docusaurus-search-local
Gathering detailed insights and metrics for @cmfcmf/docusaurus-search-local
Gathering detailed insights and metrics for @cmfcmf/docusaurus-search-local
Gathering detailed insights and metrics for @cmfcmf/docusaurus-search-local
@easyops-cn/docusaurus-search-local
An offline/local search plugin for Docusaurus v3
@docusaurus/theme-search-algolia
Algolia search component for Docusaurus.
docusaurus-lunr-search
Offline search component for Docusaurus V3
docusaurus-plugin-search-local
An offline/local search plugin for Docusaurus v2.
npm install @cmfcmf/docusaurus-search-local
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
451 Stars
302 Commits
66 Forks
9 Watching
4 Branches
36 Contributors
Updated on 19 Nov 2024
JavaScript (72.76%)
TypeScript (25.84%)
CSS (0.88%)
Shell (0.52%)
Cumulative downloads
Total Downloads
Last day
-6%
3,469
Compared to previous day
Last week
8.8%
21,485
Compared to previous week
Last month
3.5%
89,673
Compared to previous month
Last year
15.1%
1,008,143
Compared to previous year
9
2
35
Offline / local search for Docusaurus v2+ that works behind your firewall.
Feature Highlights:
Note: We use the open source algolia/autocomplete library for the searchbox. This library is just used as the frontend, and, unlike the default Docusaurus search experience (algolia/docsearch), does not connect to any Algolia or third-party servers.
1npm install @cmfcmf/docusaurus-search-local
or
1yarn add @cmfcmf/docusaurus-search-local
Add this plugin to the plugins
array in docusaurus.config.js
.
1module.exports = { 2 // ... 3 plugins: [require.resolve("@cmfcmf/docusaurus-search-local")], 4 5 // or, if you want to specify options: 6 7 // ... 8 plugins: [ 9 [ 10 require.resolve("@cmfcmf/docusaurus-search-local"), 11 { 12 // Options here 13 }, 14 ], 15 ], 16};
The following options are available (defaults are shown below):
1{ 2 // whether to index docs pages 3 indexDocs: true, 4 5 // Whether to also index the titles of the parent categories in the sidebar of a doc page. 6 // 0 disables this feature. 7 // 1 indexes the direct parent category in the sidebar of a doc page 8 // 2 indexes up to two nested parent categories of a doc page 9 // 3... 10 // 11 // Do _not_ use Infinity, the value must be a JSON-serializable integer. 12 indexDocSidebarParentCategories: 0, 13 14 // Includes parent categories path in search result 15 includeParentCategoriesInPageTitle: false, 16 17 // whether to index blog pages 18 indexBlog: true, 19 20 // whether to index static pages 21 // /404.html is never indexed 22 indexPages: false, 23 24 // language of your documentation, see next section 25 language: "en", 26 27 // setting this to "none" will prevent the default CSS to be included. The default CSS 28 // comes from autocomplete-theme-classic, which you can read more about here: 29 // https://www.algolia.com/doc/ui-libraries/autocomplete/api-reference/autocomplete-theme-classic/ 30 // When you want to overwrite CSS variables defined by the default theme, make sure to suffix your 31 // overwrites with `!important`, because they might otherwise not be applied as expected. See the 32 // following comment for more information: https://github.com/cmfcmf/docusaurus-search-local/issues/107#issuecomment-1119831938. 33 style: undefined, 34 35 // The maximum number of search results shown to the user. This does _not_ affect performance of 36 // searches, but simply does not display additional search results that have been found. 37 maxSearchResults: 8, 38 39 // lunr.js-specific settings 40 lunr: { 41 // When indexing your documents, their content is split into "tokens". 42 // Text entered into the search box is also tokenized. 43 // This setting configures the separator used to determine where to split the text into tokens. 44 // By default, it splits the text at whitespace and dashes. 45 // 46 // Note: Does not work for "ja" and "th" languages, since these use a different tokenizer. 47 tokenizerSeparator: /[\s\-]+/, 48 // https://lunrjs.com/guides/customising.html#similarity-tuning 49 // 50 // This parameter controls the importance given to the length of a document and its fields. This 51 // value must be between 0 and 1, and by default it has a value of 0.75. Reducing this value 52 // reduces the effect of different length documents on a term’s importance to that document. 53 b: 0.75, 54 // This controls how quickly the boost given by a common word reaches saturation. Increasing it 55 // will slow down the rate of saturation and lower values result in quicker saturation. The 56 // default value is 1.2. If the collection of documents being indexed have high occurrences 57 // of words that are not covered by a stop word filter, these words can quickly dominate any 58 // similarity calculation. In these cases, this value can be reduced to get more balanced results. 59 k1: 1.2, 60 // By default, we rank pages where the search term appears in the title higher than pages where 61 // the search term appears in just the text. This is done by "boosting" title matches with a 62 // higher value than content matches. The concrete boosting behavior can be controlled by changing 63 // the following settings. 64 titleBoost: 5, 65 contentBoost: 1, 66 tagsBoost: 3, 67 parentCategoriesBoost: 2, // Only used when indexDocSidebarParentCategories > 0 68 } 69}
You can now use the search bar to search your documentation.
Important: Search only works for the statically built documentation (i.e., after you ran npm run docusaurus build
in your documentation folder).
Search does not work in development (i.e., when running npm run docusaurus start
).
If you want to test search locally, first build the documentation with npm run docusaurus build
, and then serve it via npm run docusaurus serve
.
Use the language
option if your documentation is not written in English. You can either specify a single language or an array of multiple languages.
The following languages are available:
ar, da, de, en, es, fi, fr, hi, hu, it, ja, nl, no, pt, ro, ru, sv, th, tr, vi, zh
Important: For Chinese language support (zh
), you also have to install the nodejieba
npm package at ^2.5.0 || ^3.0.0
.
Documentation versions created with the official Docusaurus docs plugin are supported.
The search bar defaults to the latest version (not next
, but the latest version defined in versions.json
) when not on a documentation page (e.g., when looking at a blog post or a static page).
If the user visits a documentation page, the version is extracted from the page and search will only search the documentation of that version.
The searchbar placeholder text always reflects the currently detected documentation version.
This plugin supports documentation using Docusaurus i18n out of the box.. Please contribute additional translations by creating a new translation file in the codeTranslations subfolder and submitting a PR.
You can also adjust translations by modifiying the translations in <yourfolder>/i18n/<locale>/code.json
that start with cmfcmf/d-s-l.
.
Read more at: https://docusaurus.io/docs/i18n/tutorial#translate-json-files
If building your documentation produces an error, you can build it in debug mode to figure out
which page is causing it. To do so, simply set the DEBUG
environment variable when building
your documentation: DEBUG=1 npm run docusaurus build
.
Please see the CONTRIBUTING.md file for further information.
MIT
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
4 commit(s) and 2 issue activity found in the last 90 days -- score normalized to 5
Reason
5 existing vulnerabilities detected
Details
Reason
branch protection is not maximal on development and all release branches
Details
Reason
dependency not pinned by hash detected -- score normalized to 2
Details
Reason
Found 3/22 approved changesets -- score normalized to 1
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More