Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ To turn off type generation in docstrings use the `-notypes` template of the des
- [docBlockr](docs/docblockr.md)
- [one-line-sphinx](docs/one-line-sphinx.md)
- [pep257](docs/pep257.md)
- [mkdocs](docs/mkdocs.md)

## Usage

Expand Down
30 changes: 30 additions & 0 deletions docs/mkdocs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# MkDocs Docstring Format

```python
def abc(a: int, c = [1,2]):
"""_summary_



#### Args
> ##### `a: int`
> _description_

> ##### `c: list = [1,2]`
> _description_


#### Raises
> ##### `AssertionError`
> _description_


#### Returns
> ##### `_type_`
> _description_
"""
if a > 10:
raise AssertionError("a is more than 10")

return c
```
43 changes: 43 additions & 0 deletions src/docstring/templates/mkdocs.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{{! MkDocs Docstring Template }}
{{summaryPlaceholder}}

{{extendedSummaryPlaceholder}}
{{#parametersExist}}

#### Args
{{#args}}
> ##### `{{var}}: {{typePlaceholder}}`
> {{descriptionPlaceholder}}

{{/args}}
{{#kwargs}}
> ##### `{{var}}: {{typePlaceholder}} = {{&default}}`
> {{descriptionPlaceholder}}

{{/kwargs}}
{{/parametersExist}}
{{#exceptionsExist}}

#### Raises
{{#exceptions}}
> ##### `{{type}}`
> {{descriptionPlaceholder}}

{{/exceptions}}
{{/exceptionsExist}}
{{#returnsExist}}

#### Returns
{{#returns}}
> ##### `{{typePlaceholder}}`
> {{descriptionPlaceholder}}
{{/returns}}
{{/returnsExist}}
{{#yieldsExist}}

#### Yields
{{#yields}}
> ##### `{{typePlaceholder}}`
> {{descriptionPlaceholder}}
{{/yields}}
{{/yieldsExist}}