docusaurus/packages/docusaurus-plugin-content-docs/src/sidebars
Joshua Chen 2eeb0e46a2
feat(utils): JSDoc for all APIs (#6980)
* feat(utils): JSDoc for all APIs

* fix tests
2022-03-24 21:34:31 +08:00
..
__tests__ chore: do not print prototype in jest snapshot (#6908) 2022-03-13 19:34:50 +08:00
README.md refactor(content-docs): clean up sidebars logic; validate generator returns (#6596) 2022-02-04 09:46:25 +08:00
generator.ts test: improve test coverage (#6857) 2022-03-06 17:55:21 +08:00
index.ts fix(content-docs): give context about sidebar loading failure (#6887) 2022-03-10 11:21:10 +08:00
normalization.ts fix(content-docs): improve sidebar shorthand normalization error message (#6745) 2022-02-23 13:03:58 +01:00
postProcessor.ts test: improve test coverage; multiple internal refactors (#6912) 2022-03-14 21:53:57 +08:00
processor.ts refactor: ensure lodash is default-imported (#6716) 2022-02-19 18:15:02 +08:00
types.ts feat(content-docs): allow custom props through _category_.json (#6780) 2022-03-05 18:52:36 +08:00
utils.ts feat(utils): JSDoc for all APIs (#6980) 2022-03-24 21:34:31 +08:00
validation.ts feat(content-docs): allow custom props through _category_.json (#6780) 2022-03-05 18:52:36 +08: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.
  5. Post-processing. Defaults are applied (collapsed states), category links are resolved, empty categories are flattened. Returns Sidebars.