Skip to content

Commit ce90d48

Browse files
committed
README: Further tweaks
- Use more standard header characters - Move Python invocation to a separate section - Correct capitalization of doc8 Change-Id: I9ddddf216886ca91d5c1c381474bd008ce151f57 Signed-off-by: Stephen Finucane <stephen@that.guru>
1 parent ac5808c commit ce90d48

File tree

1 file changed

+38
-38
lines changed

1 file changed

+38
-38
lines changed

README.rst

+38-38
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,27 @@
1313
:alt: GitHub last commit
1414

1515
====
16-
Doc8
16+
doc8
1717
====
1818

19-
Doc8 is an *opinionated* style checker for `rst`_ (with basic support for
19+
*doc8* is an *opinionated* style checker for rst__ (with basic support for
2020
plain text) styles of documentation.
2121

22-
QuickStart
23-
==========
22+
__ http://docutils.sourceforge.net/docs/ref/rst/introduction.html
23+
24+
Quick start
25+
-----------
2426

2527
::
2628

2729
pip install doc8
2830

29-
To run doc8 just invoke it against any doc directory::
31+
To run *doc8*, just invoke it against any documentation directory::
3032

3133
$ doc8 cool-project/docs
3234

3335
Usage
34-
=====
35-
36-
Command line usage
37-
******************
36+
-----
3837

3938
::
4039

@@ -91,8 +90,8 @@ Command line usage
9190
-v, --verbose run in verbose mode.
9291
--version show the version and exit.
9392

94-
Ini file usage
95-
**************
93+
INI file usage
94+
~~~~~~~~~~~~~~
9695

9796
Instead of using the CLI for options the following files will also be examined
9897
for ``[doc8]`` sections that can also provide the same set of options. If
@@ -118,35 +117,11 @@ An example section that can be placed into one of these files::
118117
only variation of this being the ``no-sphinx`` option which from the
119118
configuration file will be ``sphinx`` instead).
120119

121-
Python Usage
122-
************
123-
124-
To call doc8 from a Python project do::
125-
126-
from doc8 import doc8
127-
128-
result = doc8(allow_long_titles=True, max_line_length=99)
129-
130-
The returned ``result`` will have the following attributes and methods:
131-
132-
* ``result.files_selected`` - number of files selected
133-
* ``result.files_ignored`` - number of files ignored
134-
* ``result.error_counts`` - ``dict`` of ``{check_name: error_count}``
135-
* ``result.total_errors`` - total number of errors found
136-
* ``result.errors`` - list of
137-
``(check_name, filename, line_num, code, message)`` tuples
138-
* ``result.report()`` - returns a human-readable report as a string
139-
140-
Note that calling ``doc8`` in this way will not write to stdout, so the
141-
``quiet`` and ``verbose`` options are ignored.
142-
143-
144120
Option conflict resolution
145-
**************************
121+
~~~~~~~~~~~~~~~~~~~~~~~~~~
146122

147123
When the same option is passed on the command line and also via configuration
148-
files the following strategies are applied to resolve these types
149-
of conflicts.
124+
files the following strategies are applied to resolve these types of conflicts.
150125

151126
====================== =========== ========
152127
Option Overrides Merges
@@ -169,4 +144,29 @@ option (for example by becoming a larger list or set of values that contains
169144
the values passed on the command line *and* the values passed via
170145
configuration).
171146

172-
.. _rst: http://docutils.sourceforge.net/docs/ref/rst/introduction.html
147+
148+
API
149+
---
150+
151+
It is also possible to use *doc8* programmatically. To call *doc8* from a
152+
Python project, use::
153+
154+
from doc8 import doc8
155+
156+
result = doc8(allow_long_titles=True, max_line_length=99)
157+
158+
The returned ``result`` will have the following attributes and methods:
159+
160+
* ``result.files_selected`` - number of files selected
161+
* ``result.files_ignored`` - number of files ignored
162+
* ``result.error_counts`` - ``dict`` of ``{check_name: error_count}``
163+
* ``result.total_errors`` - total number of errors found
164+
* ``result.errors`` - list of
165+
``(check_name, filename, line_num, code, message)`` tuples
166+
* ``result.report()`` - returns a human-readable report as a string
167+
168+
The ``doc8`` method accepts the same arguments as the executable. Simply
169+
replace hyphens with underscores.
170+
171+
**Note:** Calling ``doc8`` in this way will not write to stdout, so the
172+
``quiet`` and ``verbose`` options are ignored.

0 commit comments

Comments
 (0)