Provide local search to your documentation site.
Uses flexsearch.
npm i vitepress-plugin-search flexsearch -D
//vite.config.ts
import { SearchPlugin } from "vitepress-plugin-search";
import { defineConfig } from "vite";
//default options
var options = {
...flexSearchIndexOptions,
previewLength: 62,
buttonLabel: "Search",
placeholder: "Search docs",
allow: [],
ignore: [],
};
export default defineConfig({
plugins: [SearchPlugin(options)],
});
import { SearchPlugin } from "vitepress-plugin-search";
import { defineConfig } from "vitepress";
export default defineConfig({
vite: { plugins: [SearchPlugin(options)] }
});
Accept FlexSearch Index Options
Provided by flexsearch