feat(content-docs): sidebar item type "html" for rendering pure markup (#6519)

Co-authored-by: sebastienlorber <lorber.sebastien@gmail.com>
This commit is contained in:
Jody Heavener 2022-02-02 13:38:35 -04:00 committed by GitHub
parent 65ba551f5b
commit 6ec0db4722
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 172 additions and 3 deletions

View file

@ -123,12 +123,13 @@ export function findFirstCategoryLink(
for (const subItem of item.items) {
if (subItem.type === 'link') {
return subItem.href;
}
if (subItem.type === 'category') {
} else if (subItem.type === 'category') {
const categoryLink = findFirstCategoryLink(subItem);
if (categoryLink) {
return categoryLink;
}
} else if (subItem.type === 'html') {
// skip
} else {
throw new Error(
`Unexpected category item type for ${JSON.stringify(subItem)}`,