docusaurus/packages/docusaurus-plugin-content-docs/src/sidebars
Davide Donadio 5c271f5622
feat(content-docs): add support for sidebar item category/link descriptions in generated index page (#8236)
Co-authored-by: Davide Donadio <davide.donadio@it.clara.net>
Co-authored-by: sebastienlorber <lorber.sebastien@gmail.com>
2023-03-16 10:14:42 +01:00
..
__tests__ feat(docs,blog,pages): add support for "unlisted" front matter - hide md content in production (#8004) 2022-11-03 14:31:41 +01:00
README.md fix(content-docs): restore functionality when a category only has index page (#7385) 2022-05-10 14:50:43 +08:00
generator.ts refactor: fix a lot of errors in type-aware linting (#7477) 2022-05-24 15:40:26 +08:00
index.ts chore: enable import/order rule (#7418) 2022-05-14 23:39:50 +08:00
normalization.ts fix(content-docs): allow translating doc labels in sidebars.js (#7634) 2022-06-16 16:11:21 +02:00
postProcessor.ts test: fix ALL type errors in tests (#7487) 2022-05-25 14:01:10 +08:00
processor.ts chore: enable import/order rule (#7418) 2022-05-14 23:39:50 +08:00
types.ts feat(content-docs): add support for sidebar item category/link descriptions in generated index page (#8236) 2023-03-16 10:14:42 +01:00
utils.ts feat(docs,blog,pages): add support for "unlisted" front matter - hide md content in production (#8004) 2022-11-03 14:31:41 +01:00
validation.ts feat(content-docs): add support for sidebar item category/link descriptions in generated index page (#8236) 2023-03-16 10:14:42 +01: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.