Skip to content

Commit 3e7e204

Browse files
committed
doc: add section discussing text patterns to usage docs
1 parent 7f6cf6f commit 3e7e204

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

docs/source/usage.rst

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,3 +151,52 @@ Use with GitHub Actions
151151
action.
152152

153153
.. _`python-lint-plus`: https://github.com/marketplace/actions/python-code-style-quality-and-lint
154+
155+
Dostring Text Patterns
156+
======================
157+
158+
``docformatter`` began as a simple tool to format docstrings to follow PEP257. It
159+
was originally a single Python script of 118 lines containing seven functions.
160+
That's no longer the case as an inspection of the codebase will show. Over time,
161+
``docformatter`` has grown to include a number of features that have been requested
162+
by its most fantastic user base.
163+
164+
In the early days, ``docformatter`` only formatted simple docstrings. "Complex" text
165+
patterns like lists, parameter descriptions, and reStructuredText (reST) sections
166+
caused ``docformatter`` to simply skip formatting the docstring. As feature requests
167+
have been and will be incorporated, ``docformatter`` has gained the ability to
168+
recognize and format more complex text patterns.
169+
170+
As a result, it is necessary for the user to properly format their docstrings to
171+
follow the patterns documented in the various specifications. These specifications
172+
would include:
173+
174+
- PEP 257 - Docstring Conventions
175+
https://www.python.org/dev/peps/pep-0257/
176+
- reStructuredText (reST) Markup Specification
177+
https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html
178+
- Sphinx Documentation Style
179+
https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html
180+
- Epydoc Documentation Style
181+
http://epydoc.sourceforge.net/manual-fields.html
182+
183+
Any docstring that does not follow these specifications may not be formatted properly
184+
as these patterns may be recognized by ``docformatter`` as simple text that needs to
185+
formatted. For example, if a user writes a docstring that contains a list but does not
186+
format the list according to reST specifications, ``docformatter`` may not recognize
187+
the list and may format the list items as simple text. This could result in a
188+
list that is not properly indented or wrapped.
189+
190+
The user is encouraged to read and follow these specifications when writing
191+
docstrings to ensure that ``docformatter`` can properly format them. Issues reported
192+
to the ``docformatter`` project that are the result of docstrings not following these
193+
specifications will be closed as ``S:wontfix`` with a request for the user to update
194+
their docstrings to follow the specifications.
195+
196+
Additionally, as ``docformatter`` continues to add support for more text patterns (e.g.,
197+
Numpy or Google style docstrings), new releases may result in significant docstring
198+
formatting changes in your code base. While we hate to see this happen to our users,
199+
it is the result of our desire to make ``docformatter`` the best tool it can be for
200+
formatting docstrings and the best way to achieve that is to strigently comply with
201+
the various specifications. We appreciate your understanding and patience as we
202+
continue to improve ``docformatter``.

0 commit comments

Comments
 (0)