Generate API documentation automatically from source code during site builds.
Do I Need This?
Note
Skip this if: You write all documentation manually.
Read this if: You want API docs from Python docstrings, CLI help from Click commands, or API specs from OpenAPI.
How It Works
Autodoc generates virtual pages during your site build — no intermediate markdown files are created. Simply configure the sources in yourbengal.tomland the documentation appears in your built site.
Configuration
Configure autodoc in yourbengal.toml:
1 2 3 4 5 6 7 | |
Extracts:
- Module and class docstrings
- Function signatures and type hints
- Examples from docstrings
1 2 3 4 5 6 | |
Extracts:
- Command descriptions
- Argument documentation
- Option flags and defaults
1 2 3 4 | |
Extracts:
- Endpoint documentation
- Request/response schemas
- Authentication requirements
Python Configuration Options
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | |
Building with Autodoc
Once configured, autodoc runs automatically during builds:
bengal build
The generated API documentation appears in your output directory alongside your regular content.
Strict Mode
Enable strict mode to fail builds on extraction or rendering errors:
1 2 | |
Tip
Best practice: Enable strict mode in CI pipelines to catch documentation issues early.
Seealso
- Architecture Reference — Technical details and API usage