Generates Markdown documentation from Python module dosctrings
Project description
python-docstring-markdown
A Python module and CLI that walks a Python package/directory and outputs a Markdown file from all docstrings in the package.
Tools like mkdocs and readthedocs are overkill for many small Python projects. This project exists to provide a simple way to generate Markdown documentation that can be stored alongside your code in Github.
Features
- Crawls the packages, modules, classes, functions, and methods using the
astmodule - Auto-detects ReST, Google, Numpydoc-style and Epydoc docstrings using
docstring-parser-fork - Generates a table of contents with anchor links
- Tracks and documents module exports (
__all__) - Preserves module hierarchy in documentation
- Handles nested classes and functions
Installation
pip install python-docstring-markdown
Usage
Command Line
python -m python_docstring_markdown <package_dir> <output_path>
Arguments:
package_dir: Path to your Python package directory.output_path: Path where the Markdown documentation file will be saved. A path that ends in.mdwill result in a single file. A directory path will result in one.mdper-module.
Example:
python -m python_docstring_markdown ./src/my_package docs/api.md
Python API
from python_docstring_markdown import crawl
# Generate documentation for a package
docs_content = crawl("./src/my_package")
# Save to a file
with open("docs/api.md", "w") as f:
f.write(docs_content)
Documentation
See the DOCUMENTATION.md file for more information. It also serves as an example of how the documentation is generated.
Contributing
I welcome feedback and contributions!
License
CC-0 1.0 Universal. See the LICENSE file for more information.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file python_docstring_markdown-0.4.0.tar.gz.
File metadata
- Download URL: python_docstring_markdown-0.4.0.tar.gz
- Upload date:
- Size: 17.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: pdm/2.25.9 CPython/3.12.3 Linux/6.11.0-1018-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
99796187d1dd80cde4e370f30dcba5697f5dac0fcd7d06e56a91481b4b695cbc
|
|
| MD5 |
0b603d8b8e06c9129a47dffd0b901a48
|
|
| BLAKE2b-256 |
45113db44578271a53a4ed784917a6507e262574a28c896fbdf9729ee3524907
|
File details
Details for the file python_docstring_markdown-0.4.0-py3-none-any.whl.
File metadata
- Download URL: python_docstring_markdown-0.4.0-py3-none-any.whl
- Upload date:
- Size: 12.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: pdm/2.25.9 CPython/3.12.3 Linux/6.11.0-1018-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
69ae4610f6feee2f28649210340dc715bfb0412639fb8db309bbfdd599edcc5b
|
|
| MD5 |
8e290ad4fdbc08486e7c96af15a4fc36
|
|
| BLAKE2b-256 |
2307b46a725cd0bac304381cf39277c0bb26c454956cf15e5db2aae57e398a33
|