docs: support multiple sidebars in a project (#11768)
* changed to new sidebar across projects except resources * finalize multi sidebar support * clean up * remove redundant property * small changes * fixes * generate * fix error * fix initial open
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
import path from "path"
|
||||
import type { Transformer } from "unified"
|
||||
import type { RawSidebarItem } from "types"
|
||||
import type { UnistTree } from "types"
|
||||
import type { Sidebar, UnistTree } from "types"
|
||||
|
||||
export function pageNumberRehypePlugin({
|
||||
sidebar,
|
||||
}: {
|
||||
sidebar: RawSidebarItem[]
|
||||
sidebar: Sidebar.RawSidebarItem[]
|
||||
}): Transformer {
|
||||
return async (tree, file) => {
|
||||
const { valueToEstree } = await import("estree-util-value-to-estree")
|
||||
@@ -66,9 +65,9 @@ export function pageNumberRehypePlugin({
|
||||
}
|
||||
|
||||
function findSidebarItem(
|
||||
sidebar: RawSidebarItem[],
|
||||
sidebar: Sidebar.RawSidebarItem[],
|
||||
path: string
|
||||
): RawSidebarItem | undefined {
|
||||
): Sidebar.RawSidebarItem | undefined {
|
||||
let foundItem = undefined
|
||||
for (const item of sidebar) {
|
||||
if (item.type === "separator") {
|
||||
|
||||
Reference in New Issue
Block a user