Quick Tip: Generate Markdown Docs from a Single File
If you have a single Python module with well‑structured docstrings, you can let the AI‑powered tool churn out a full Markdown documentation file with just one command.
# From your project root
docsgen --input src/utils.py --output docs/utils.md
What happens under the hood
- Parsing – The tool parses the source file and extracts every docstring, type hint, and code comment.
- Contextual Formatting – Using the AI model, it converts the extracted information into human‑readable Markdown, adding sections like Overview, Parameters, Returns, and Examples automatically.
- Optional Enhancements – If you’ve added
# @diagrammarkers, the tool will embed simple flow‑chart diagrams inline.
Resulting utils.md
# utils
Utility helpers for string manipulation
## Functions
### `normalize_text(text: str, lower: bool = True) -> str`
Normalizes a string by stripping whitespace, removing punctuation, and optionally lower‑casing it.
#### Parameters
- **text** *(str)* – The input string.
- **lower** *(bool, optional)* – Convert to lowercase. Defaults to **True**.
#### Returns
*(str)* – The cleaned string.
#### Example
from utils import normalize_text
normalize_text("Hello, World!")
→ "hello world"
Why this is handy
- One‑liner workflow: No manual Markdown writing, just run the command.
- Consistent format: Every function gets the same section structure, making the docs easier to read.
- AI‑generated context: The tool infers usage examples from the code, reducing boilerplate.
Give it a try on any module and watch the documentation pop out in seconds!