mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-18 02:32:28 +02:00
Co-authored-by: sebastienlorber <lorber.sebastien@gmail.com> Co-authored-by: Joshua Chen <sidachen2003@gmail.com> Co-authored-by: Sébastien Lorber <slorber@users.noreply.github.com> Co-authored-by: whiteand <andrewbeletskiy@gmail.com> Co-authored-by: yzhe819 <68207314+yzhe819@users.noreply.github.com> Co-authored-by: Ngô Quốc Đạt <56961917+datlechin@users.noreply.github.com> Co-authored-by: Kevin Østerkilde <kevin@oesterkilde.dk> Co-authored-by: Bagdasar Ovsepyan <66012777+b-ovsepian@users.noreply.github.com> Co-authored-by: Yoni Chechik <chechik.yoni@gmail.com> Co-authored-by: adventure-yunfei <adventure.yunfei@gmail.com> Co-authored-by: Morgane Dubus <30866152+mdubus@users.noreply.github.com> |
||
---|---|---|
.. | ||
__tests__ | ||
generator.ts | ||
index.ts | ||
normalization.ts | ||
postProcessor.ts | ||
processor.ts | ||
README.md | ||
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
autogenerated
items 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
.