8000 Search top level (#459) · joernalraun/python-editor-next@582e7ac · GitHub
[go: up one dir, main page]

Skip to content

Commit 582e7ac

Browse files
Search top level (microbit-foundation#459)
* Add explore topic to search * Add module to search
1 parent 9b67f98 commit 582e7ac

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/documentation/search-hooks.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,12 @@ const exploreSearchableContent = (
158158
const content: SearchableContent[] = [];
159159
if (state.status === "ok") {
160160
state.toolkit.contents?.forEach((t) => {
161+
content.push({
162+
id: t.slug.current,
163+
title: t.name,
164+
containerTitle: t.name,
165+
content: t.subtitle + ".\n\n" + blocksToText(t.introduction),
166+
});
161167
t.contents?.forEach((e) => {
162168
const contentString = blocksToText(e.content);
163169
const detailContentString = blocksToText(e.detailContent);
@@ -193,6 +199,12 @@ const referenceSearchableContent = (
193199
};
194200
if (toolkit) {
195201
for (const module of Object.values(toolkit)) {
202+
content.push({
203+
id: module.id,
204+
title: module.fullName,
205+
containerTitle: module.fullName,
206+
content: validateString(module.docString),
207+
});
196208
addNestedDocs(module.fullName, module.children);
197209
}
198210
}

0 commit comments

Comments
 (0)
0