feat: document contextual and temporal help
This commit is contained in:
@@ -857,9 +857,12 @@ function selectedPageFromSearch(search: string, pages: DocsPageNode[]): DocsPage
|
||||
if (requested) return pages.find((page) => page.id === requested) ?? pages[0];
|
||||
const helpContext = params.get("context") || "";
|
||||
if (helpContext) {
|
||||
const exact = pages.find((page) => page.kind === "topic" && metadataList(page.topic.metadata, "help_contexts").includes(helpContext));
|
||||
if (exact) return exact;
|
||||
const moduleId = helpContextModuleId(helpContext);
|
||||
const fallbackContext = params.get("fallback_context") || "";
|
||||
for (const contextId of [helpContext, fallbackContext].filter(Boolean)) {
|
||||
const exact = pages.find((page) => page.kind === "topic" && metadataList(page.topic.metadata, "help_contexts").includes(contextId));
|
||||
if (exact) return exact;
|
||||
}
|
||||
const moduleId = params.get("module") || helpContextModuleId(fallbackContext || helpContext);
|
||||
const moduleTopic = pages.find((page) => page.kind === "topic" && page.topic.source_module_id === moduleId);
|
||||
if (moduleTopic) return moduleTopic;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user