$ show cmfcmf/docusaurus-search-local
This repository is a Docusaurus v3+ plugin that provides offline/local search functionality. It operates in two phases: at build time, it parses the generated HTML pages (docs, blog, static pages) using cheerio, extracts text and metadata, and builds Lunr.js search indexes per documentation version/language. At runtime, it serves a React-based search bar using @algolia/autocomplete-js that fetches the pre-built index JSON and performs client-side searches with Lunr. The plugin supports multiple languages, documentation versions, i18n, and configurable boosting of title/content/tags. It is a well-engineered monorepo with a single plugin package and an example Docusaurus site for testing. The code is TypeScript, has unit and e2e tests, and follows modern development practices (pnpm workspaces, Turborepo, conventional commits).
The LLM identified 1 files worth highlighting for reuse:
Provides the `html2text` function that extracts page title, sections, tags, and sidebar parent categories from Docusaurus-generated HTML. It handles different page types (docs, blog, static), removes unwanted elements (version badges, copy buttons, style/script tags), and correctly parses headings and their associated content. This module is well-tested, self-contained, and could be reused in any project that needs to parse Docusaurus output for indexing or analysis.