docusaurus/packages/docusaurus-plugin-content-docs/src/sidebars
Jody Heavener 683ba3d2a0
feat(docs,blog,pages): add support for "unlisted" front matter - hide md content in production (#8004)
Co-authored-by: sebastienlorber <lorber.sebastien@gmail.com>
2022-11-03 14:31:41 +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(docs,blog,pages): add support for "unlisted" front matter - hide md content in production (#8004) 2022-11-03 14:31:41 +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(plugin-docs): docs sidebar item link: support "autoAddBaseUrl" attribute (#7949) 2022-08-12 12:50:12 +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.