-
Notifications
You must be signed in to change notification settings - Fork 276
Add support for custom sidebar DocItem generators supporting customisation #963
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
* LICENSE file in the root directory of this source tree. | ||
* ========================================================================== */ | ||
|
||
import { SidebarItemDoc } from "@docusaurus/plugin-content-docs/src/sidebars/types"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure that this is the right path to import types from There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it works, since our plugin aims to be 100% compatible with Docusaurus sidebars, i.e. we don't extend the |
||
import type Request from "postman-collection"; | ||
|
||
import { | ||
|
@@ -57,12 +58,18 @@ export interface MarkdownGenerator { | |
createSchemaPageMD?: (pageData: SchemaPageMetadata) => string; | ||
} | ||
|
||
export type ApiDocItemGenerator = ( | ||
item: ApiPageMetadata | SchemaPageMetadata, | ||
context: { sidebarOptions: SidebarOptions; basePath: string } | ||
) => SidebarItemDoc; | ||
|
||
export interface SidebarOptions { | ||
groupPathsBy?: string; | ||
categoryLinkSource?: "info" | "tag" | "auto"; | ||
customProps?: { [key: string]: unknown }; | ||
sidebarCollapsible?: boolean; | ||
sidebarCollapsed?: boolean; | ||
createDocItem?: ApiDocItemGenerator; | ||
} | ||
|
||
export interface APIVersionOptions { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method was extracted from where it was originally because it relied on
basePath
andcustomProps
from higher scope. I've hoisted it and provided those via thecontext
argument instead.