@@ -5,14 +5,11 @@ to serve as a basic building-block for building customized documentation
55systems. Simply put, [ Docstring] ( README.md ) extracts and parses docstrings and
66gives you access to their data so you can decide what you want to do with it.
77
8- * Support for ` C ` and ` Python ` code .
8+ * Support for ` Python ` code (support ` C ` is planned) .
99* Support for [ Google-style docstrings] ( http://google.github.io/styleguide/pyguide.html )
1010* Produces [ JSON] ( https://www.json.org/ ) , plain-text, and [ markdown] ( http://commonmark.org/ ) output for modules, classes, functions, and
1111 methods.
1212
13- If you are interested in learning about what motivated me to develop this
14- package, you can read my story [ here] ( motivation.md ) .
15-
1613## Contents
1714 * [ Getting Started] ( #getting-started )
1815 * [ Usage] ( #usage )
@@ -37,16 +34,17 @@ $ docstring --help
3734docstring
3835
3936Usage:
40- docstring <file> <name> [-tmj]
37+ docstring <file> <name> [-tmj] [-T=<tpl>]
4138 docstring -h | --help
4239 docstring --version
4340
4441Options:
4542 -h --help Show help (this screen).
4643 --version Show version.
47- -m --markdown Render docstring as Markdown.
48- -t --text Render docstring as text.
49- -j --json Render docstring as JSON.
44+ -m --markdown Output extracted docstring as Markdown.
45+ -t --text Output extracted docstring as plain-text.
46+ -j --json Output extracted docstring as JSON.
47+ -T=<tpl> --template=<tpl> Set template for Markdown output.
5048
5149Examples:
5250 Extract the module docstring
6361 https://github.com/ooreilly/docstring
6462```
6563
66- ### Python Examples
67- In this example, we will extract a docstring from ` example.py ` and output it as
68- plain-text, markdown, and JSON. Note that the tool works by locating the source
69- file directly, no module imports are needed.
70-
71- The code for ` example.py ` can be found in [ examples/example.py] ( examples/example.py ) and is given by
7264``` python
7365def example_function (arg1 , arg2 = 1 ):
7466 """
@@ -94,16 +86,15 @@ def example_function(arg1, arg2=1):
9486
9587 Raises:
9688
97- ValueError: This is exception is raised when arg1 and arg2 are the same .
89+ ValueError: This is exception is raised when arg1 and arg2 are equal .
9890
9991 """
10092 if arg1 == arg2:
101- raise ValueError (" `arg1` and `arg2` cannot be the same " )
93+ raise ValueError (" `arg1` and `arg2` cannot be equal. " )
10294 if arg1 > arg2:
10395 return True
10496 else :
10597 return False
106-
10798```
10899
109100#### Plain-text
@@ -146,7 +137,7 @@ format the data)
146137$ docstring examples/example.py --json > examples/example_py.md
147138
148139```
149- Go to [ examples/module_level_function .json] ( examples/module_level_function .json ) to
140+ Go to [ examples/example_py .json] ( examples/example_py .json ) to
150141view the output for this example.
151142
152143### Installing
@@ -194,13 +185,13 @@ new issue if you want to suggest a new feature. Ideally, post a feature
194185request to discuss it before you implement it and make a pull request.
195186
196187If you are contributing new code, then
197- 1 . Make sure to fork the repository and create a new branch `git checkout -b
198- my_feature` .
199- 2 . Implement your feature and prepare a test case using ` pytest ` to demonstrate
200- how your feature works and that it performs according to expectations .
188+ 1 . First, fork the repository and create your own branch. Commit your changes to
189+ this branch .
190+ 2 . In your commit, please include a test case that demonstrates that your
191+ contribution works as expected using ` pytest ` .
201192 Having a test case will make it easier to review your code and therefore lead
202- to your pull request being approved faster. Also use ` pylint ` to check
203- syntax and code quality . During development it is usually simplest to disable
193+ to your pull request being approved faster. Please also use ` pylint ` to check
194+ for issues . During development it is usually simplest to disable
204195 reports via ` pylint my_feature.py --reports=n ` and then enable again once all
205196 issues have been corrected. Make sure that you test all parts of your code
206197 using a coverage tool such as ` py-cov ` .
@@ -235,10 +226,6 @@ These are some projects that inspired me to develop this tool.
235226* [ docsify] ( https://github.com/QingWei-Li/docsify/ ) Markdown-based documentation
236227 site generator.
237228
238- These posts were also a source of inspiration:
239- * [ ]
240-
241-
242229## License
243230
244231This project is licensed under the MIT License - see the
0 commit comments