docusaurus/packages/docusaurus-plugin-content-docs/src/sidebars
2025-06-27 16:05:01 +02:00
..
__tests__ add test for generator key propagation 2025-06-27 16:05:01 +02:00
generator.ts do not always add key attribute 2025-06-27 16:00:01 +02:00
index.ts feat(core): support TypeScript + ESM configuration (#9317) 2023-10-14 02:46:03 +02:00
normalization.ts
postProcessor.ts fix(docs): Fix empty sidebar item category className lost when post-processed to a doc (#11281) 2025-06-19 19:04:28 +02:00
processor.ts
README.md
types.ts Add initial implementation of sidebar keys 2025-06-27 15:45:09 +02:00
utils.ts refactor: remove unnecessary undefined & use optional chain (#11192) 2025-05-26 13:07:56 +02:00
validation.ts Add initial implementation of sidebar keys 2025-06-27 15:45:09 +02:00

Sidebars

This part is very complicated and hard to navigate. Sidebars are loaded through the following steps:

  1. Loading. The sidebars file is read. Returns SidebarsConfig.
  2. Normalization. The shorthands are expanded. This step is very lenient about the sidebars' shapes. Returns NormalizedSidebars.
  3. 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.
  4. Generation. This step is done through the "processor" (naming is hard). The autogenerated items are unwrapped. In the future, steps 3 and 4 may be repeatedly done until all autogenerated items are unwrapped. Returns ProcessedSidebars.
    • 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.
  5. Post-processing. Defaults are applied (collapsed states), category links are resolved, empty categories are flattened. Returns Sidebars.