mirror of
https://github.com/facebook/docusaurus.git
synced 2025-12-29 21:42:50 +00:00
Co-authored-by: Joshua Chen <sidachen2003@gmail.com> Co-authored-by: sebastienlorber <lorber.sebastien@gmail.com> Co-authored-by: Sébastien Lorber <slorber@users.noreply.github.com> Co-authored-by: Ori Shalom <ori-shalom@users.noreply.github.com> Co-authored-by: Mikey O'Toole <mikey@homotechsual.dev> Co-authored-by: TheCatLady <52870424+TheCatLady@users.noreply.github.com> fix flaky screenshots, add html data-has-hydrated attribute (#9256) fix(theme-common): ThemedComponent should display something when JS is disabled (#9243) fix(theme): canonical url should be not change after hydration if url accessed with/without trailing slash (#9130) fix(theme): only set classname on ul elements if they have an existing class (#9099) fix(content-docs): sidebar generator should return customProps for doc items (#9107) |
||
|---|---|---|
| .. | ||
| __tests__ | ||
| README.md | ||
| generator.ts | ||
| index.ts | ||
| normalization.ts | ||
| postProcessor.ts | ||
| processor.ts | ||
| types.ts | ||
| utils.ts | ||
| validation.ts | ||
Sidebars
This part is very complicated and hard to navigate. Sidebars are loaded through the following steps:
- Loading. The sidebars file is read. Returns
SidebarsConfig. - Normalization. The shorthands are expanded. This step is very lenient about the sidebars' shapes. Returns
NormalizedSidebars. - Validation. The normalized sidebars are validated. This step happens after normalization, because the normalized sidebars are easier to validate, and allows us to repeatedly validate & generate in the future.
- Generation. This step is done through the "processor" (naming is hard). The
autogenerateditems are unwrapped. In the future, steps 3 and 4 may be repeatedly done until all autogenerated items are unwrapped. ReturnsProcessedSidebars.- Important: this step should only care about unwrapping autogenerated items, not filtering them, writing additional metadata, applying defaults, etc.—everything will be handled in the post-processor. Important because the generator is exposed to the end-user and we want it to be easy to be reasoned about.
- Post-processing. Defaults are applied (collapsed states), category links are resolved, empty categories are flattened. Returns
Sidebars.