@barnabask/astro-minisearch
Version:
Utilities to add a static full text index to an Astro project
24 lines (23 loc) • 752 B
TypeScript
import type { Root, Node } from "hast-util-to-text/lib";
import { PluginOptions } from "./types.js";
type AstroVFile = {
data: {
astro: {
frontmatter: Record<string, any>;
};
};
};
type AstroRehypePlugin = (tree: Root, file: AstroVFile) => void;
/**
* Core logic of plainTextPlugin, separated for testing
* @ignore
*/
export declare function toPlaintextTree(tree: Node, options: Partial<PluginOptions>): string[][] | string;
/**
* A helper to extract plain text from rendered HTML and add it to Astro frontmatter.
*
* @param options plugin options
* @returns a rehype plugin suitable for Astro
*/
export declare function plainTextPlugin(options?: Partial<PluginOptions>): () => AstroRehypePlugin;
export {};