https://github.com/projectweekend/documd
Simple markdown documentation from docstrings
https://github.com/projectweekend/documd
Last synced: over 1 year ago
JSON representation
Simple markdown documentation from docstrings
- Host: GitHub
- URL: https://github.com/projectweekend/documd
- Owner: projectweekend
- License: mit
- Created: 2016-04-02T02:44:30.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2016-04-03T00:09:52.000Z (about 10 years ago)
- Last Synced: 2025-03-02T00:20:38.229Z (over 1 year ago)
- Language: Python
- Size: 19.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://build.exitcodezero.io/projectweekend/documd)
# Usage
Write markdown documentation in your classes and decorate them with `documd.documentation.register`:
```python
from documd import documentation
@documentation.register(doc_name='API_ROUTES.md', section='This Stuff', title='This route')
class ThisApiRoute:
"""
**POST:**
```
/v1/this
```
**Body:**
```json
{
"message": "this"
}
```
**Response:**
```json
{
"message": "this"
}
```
**Status Codes:**
* `200` if successful
* `400` if incorrect data provided
"""
@documentation.register(doc_name='API_ROUTES.md', section='That Stuff', title='That route')
class ThatApiRoute:
"""
**POST:**
```
/v1/that
```
**Body:**
```json
{
"message": "that"
}
```
**Response:**
```json
{
"message": "that"
}
```
**Status Codes:**
* `200` if successful
* `400` if incorrect data provided
"""
```
Then use the `documd.documentation.generate` function in a script to output to a markdown file. Be sure to import the package that contains the decorated classes/functions in your script. For example, assuming that the two decorated classes above are in the `example.py`, a script ('example_script.py') might look like this:
```python
#!/usr/bin/env python
from documd import documentation
import example.py
def main():
documentation.generate(output_path=='.')
if __name__ == "__main__":
main()
```
Then run your script to rebuild the markdown file:
```
./example_script.py
```
An example output file can be found in [test/output_example.md](test/output_example.md).
# Run tests
```
docker-compose run cli nosetests -v
```