Description
Currently the plugin produces a search index with all content on a page as string for a route.
mosaic/packages/store/src/types/searchIndex.ts
Lines 1 to 5 in 7379927
This doesn't allow the use case to search for specific page section heading and navigate to it.
Potential solution - it may mean a similar data like below
type SearchDataPage = {
title: string;
sections: {
heading?: string;
id?: string;
content: string[];
}[];
route: string;
};
This likely means 2 different parts of change, first when indexing content, it will need to differentiate heading (e.g. AST type: "element"
andtagName: "h1"
) vs other content
mosaic/packages/plugins/src/SearchIndexPlugin.ts
Lines 114 to 127 in 7379927
I'm not sure how to deal with getting correct id
, given computing id
from heading
is not enough given potential collision. This could mean a different lifecycle method is needed for this to work?