| 1 |
======== |
| 2 |
rstcheck |
| 3 |
======== |
| 4 |
|
| 5 |
+-------------------+---------------------------------------------------------------------------------------------+ |
| 6 |
| **General** | |maintenance_y| |license| |semver| | |
| 7 |
| +---------------------------------------------------------------------------------------------+ |
| 8 |
| | |rtd| | |
| 9 |
+-------------------+---------------------------------------------------------------------------------------------+ |
| 10 |
| **CI** | |gha_tests| |gha_docu| |gha_qa| |pre_commit_ci| | |
| 11 |
+-------------------+---------------------------------------------------------------------------------------------+ |
| 12 |
| **PyPI** | |pypi_release| |pypi_py_versions| |pypi_implementations| | |
| 13 |
| +---------------------------------------------------------------------------------------------+ |
| 14 |
| | |pypi_format| |pypi_downloads| | |
| 15 |
+-------------------+---------------------------------------------------------------------------------------------+ |
| 16 |
| **Github** | |gh_tag| |gh_last_commit| | |
| 17 |
| +---------------------------------------------------------------------------------------------+ |
| 18 |
| | |gh_stars| |gh_forks| |gh_contributors| |gh_watchers| | |
| 19 |
+-------------------+---------------------------------------------------------------------------------------------+ |
| 20 |
|
| 21 |
|
| 22 |
Checks syntax of reStructuredText and code blocks nested within it. |
| 23 |
|
| 24 |
See the full documentation at `read-the-docs`_ |
| 25 |
|
| 26 |
|
| 27 |
.. contents:: |
| 28 |
|
| 29 |
|
| 30 |
Installation |
| 31 |
============ |
| 32 |
|
| 33 |
From pip |
| 34 |
|
| 35 |
.. code:: shell |
| 36 |
|
| 37 |
$ pip install rstcheck |
| 38 |
|
| 39 |
To use pyproject.toml for configuration:: |
| 40 |
|
| 41 |
$ pip install rstcheck[toml] |
| 42 |
|
| 43 |
To add sphinx support:: |
| 44 |
|
| 45 |
$ pip install rstcheck[sphinx] |
| 46 |
|
| 47 |
|
| 48 |
Supported languages in code blocks |
| 49 |
================================== |
| 50 |
|
| 51 |
- Bash |
| 52 |
- Doctest |
| 53 |
- C (C99) |
| 54 |
- C++ (C++11) |
| 55 |
- JSON |
| 56 |
- XML |
| 57 |
- Python |
| 58 |
- reStructuredText |
| 59 |
|
| 60 |
|
| 61 |
Examples |
| 62 |
======== |
| 63 |
|
| 64 |
.. rstcheck: ignore-languages=cpp,python,rst |
| 65 |
|
| 66 |
With bad Python syntax: |
| 67 |
|
| 68 |
.. code:: rst |
| 69 |
|
| 70 |
==== |
| 71 |
Test |
| 72 |
==== |
| 73 |
|
| 74 |
.. code:: python |
| 75 |
|
| 76 |
print( |
| 77 |
|
| 78 |
.. code:: text |
| 79 |
|
| 80 |
$ rstcheck bad_python.rst |
| 81 |
bad_python.rst:7: (ERROR/3) (python) unexpected EOF while parsing |
| 82 |
|
| 83 |
With bad C++ syntax: |
| 84 |
|
| 85 |
.. code:: rst |
| 86 |
|
| 87 |
==== |
| 88 |
Test |
| 89 |
==== |
| 90 |
|
| 91 |
.. code:: cpp |
| 92 |
|
| 93 |
int main() |
| 94 |
{ |
| 95 |
return x; |
| 96 |
} |
| 97 |
|
| 98 |
.. code:: text |
| 99 |
|
| 100 |
$ rstcheck bad_cpp.rst |
| 101 |
bad_cpp.rst:9: (ERROR/3) (cpp) error: 'x' was not declared in this scope |
| 102 |
|
| 103 |
With bad syntax in the reStructuredText document itself: |
| 104 |
|
| 105 |
.. code:: rst |
| 106 |
|
| 107 |
==== |
| 108 |
Test |
| 109 |
=== |
| 110 |
|
| 111 |
.. code:: text |
| 112 |
|
| 113 |
$ rstcheck bad_rst.rst |
| 114 |
bad_rst.rst:1: (SEVERE/4) Title overline & underline mismatch. |
| 115 |
|
| 116 |
|
| 117 |
.. _read-the-docs: https://rstcheck.readthedocs.io |
| 118 |
|
| 119 |
|
| 120 |
.. General |
| 121 |
|
| 122 |
.. |maintenance_n| image:: https://img.shields.io/badge/Maintenance%20Intended-✖-red.svg?style=flat-square |
| 123 |
:target: http://unmaintained.tech/ |
| 124 |
:alt: Maintenance - not intended |
| 125 |
|
| 126 |
.. |maintenance_y| image:: https://img.shields.io/badge/Maintenance%20Intended-✔-green.svg?style=flat-square |
| 127 |
:target: http://unmaintained.tech/ |
| 128 |
:alt: Maintenance - intended |
| 129 |
|
| 130 |
.. |license| image:: https://img.shields.io/github/license/rstcheck/rstcheck.svg?style=flat-square&label=License |
| 131 |
:target: https://github.com/rstcheck/rstcheck/blob/main/LICENSE |
| 132 |
:alt: License |
| 133 |
|
| 134 |
.. |semver| image:: https://img.shields.io/badge/Semantic%20Versioning-2.0.0-brightgreen.svg?style=flat-square |
| 135 |
:target: https://semver.org/ |
| 136 |
:alt: Semantic Versioning - 2.0.0 |
| 137 |
|
| 138 |
.. |rtd| image:: https://img.shields.io/readthedocs/rstcheck/latest.svg?style=flat-square&logo=read-the-docs&logoColor=white&label=Read%20the%20Docs |
| 139 |
:target: https://rstcheck.readthedocs.io/en/latest/ |
| 140 |
:alt: Read the Docs - Build Status (latest) |
| 141 |
|
| 142 |
|
| 143 |
.. CI |
| 144 |
|
| 145 |
.. |gha_tests| image:: https://img.shields.io/github/actions/workflow/status/rstcheck/rstcheck/test.yml?branch=main&style=flat-square&logo=github&label=Test%20code |
| 146 |
:target: https://github.com/rstcheck/rstcheck/actions/workflows/test.yaml |
| 147 |
:alt: Test status |
| 148 |
|
| 149 |
.. |gha_docu| image:: https://img.shields.io/github/actions/workflow/status/rstcheck/rstcheck/documentation.yml?branch=main&style=flat-square&logo=github&label=Test%20documentation |
| 150 |
:target: https://github.com/rstcheck/rstcheck/actions/workflows/documentation.yaml |
| 151 |
:alt: Documentation status |
| 152 |
|
| 153 |
.. |gha_qa| image:: https://img.shields.io/github/actions/workflow/status/rstcheck/rstcheck/qa.yml?branch=main&style=flat-square&logo=github&label=QA |
| 154 |
:target: https://github.com/rstcheck/rstcheck/actions/workflows/qa.yaml |
| 155 |
:alt: QA status |
| 156 |
|
| 157 |
.. |pre_commit_ci| image:: https://results.pre-commit.ci/badge/github/rstcheck/rstcheck/main.svg |
| 158 |
:target: https://results.pre-commit.ci/latest/github/rstcheck/rstcheck/main |
| 159 |
:alt: pre-commit status |
| 160 |
|
| 161 |
|
| 162 |
.. PyPI |
| 163 |
|
| 164 |
.. |pypi_release| image:: https://img.shields.io/pypi/v/rstcheck.svg?style=flat-square&logo=pypi&logoColor=FBE072 |
| 165 |
:target: https://pypi.org/project/rstcheck/ |
| 166 |
:alt: PyPI - Package latest release |
| 167 |
|
| 168 |
.. |pypi_py_versions| image:: https://img.shields.io/pypi/pyversions/rstcheck.svg?style=flat-square&logo=python&logoColor=FBE072 |
| 169 |
:target: https://pypi.org/project/rstcheck/ |
| 170 |
:alt: PyPI - Supported Python Versions |
| 171 |
|
| 172 |
.. |pypi_implementations| image:: https://img.shields.io/pypi/implementation/rstcheck.svg?style=flat-square&logo=python&logoColor=FBE072 |
| 173 |
:target: https://pypi.org/project/rstcheck/ |
| 174 |
:alt: PyPI - Supported Implementations |
| 175 |
|
| 176 |
.. |pypi_format| image:: https://img.shields.io/pypi/format/rstcheck.svg?style=flat-square&logo=pypi&logoColor=FBE072 |
| 177 |
:target: https://pypi.org/project/rstcheck/ |
| 178 |
:alt: PyPI - Format |
| 179 |
|
| 180 |
.. |pypi_downloads| image:: https://img.shields.io/pypi/dm/rstcheck.svg?style=flat-square&logo=pypi&logoColor=FBE072 |
| 181 |
:target: https://pypi.org/project/rstcheck/ |
| 182 |
:alt: PyPI - Monthly downloads |
| 183 |
|
| 184 |
|
| 185 |
|
| 186 |
.. GitHub |
| 187 |
|
| 188 |
.. |gh_tag| image:: https://img.shields.io/github/v/tag/rstcheck/rstcheck.svg?sort=semver&style=flat-square&logo=github |
| 189 |
:target: https://github.com/rstcheck/rstcheck/tags |
| 190 |
:alt: Github - Latest Release |
| 191 |
|
| 192 |
.. |gh_last_commit| image:: https://img.shields.io/github/last-commit/rstcheck/rstcheck.svg?style=flat-square&logo=github |
| 193 |
:target: https://github.com/rstcheck/rstcheck/commits/main |
| 194 |
:alt: GitHub - Last Commit |
| 195 |
|
| 196 |
.. |gh_stars| image:: https://img.shields.io/github/stars/rstcheck/rstcheck.svg?style=flat-square&logo=github |
| 197 |
:target: https://github.com/rstcheck/rstcheck/stargazers |
| 198 |
:alt: Github - Stars |
| 199 |
|
| 200 |
.. |gh_forks| image:: https://img.shields.io/github/forks/rstcheck/rstcheck.svg?style=flat-square&logo=github |
| 201 |
:target: https://github.com/rstcheck/rstcheck/network/members |
| 202 |
:alt: Github - Forks |
| 203 |
|
| 204 |
.. |gh_contributors| image:: https://img.shields.io/github/contributors/rstcheck/rstcheck.svg?style=flat-square&logo=github |
| 205 |
:target: https://github.com/rstcheck/rstcheck/graphs/contributors |
| 206 |
:alt: Github - Contributors |
| 207 |
|
| 208 |
.. |gh_watchers| image:: https://img.shields.io/github/watchers/rstcheck/rstcheck.svg?style=flat-square&logo=github |
| 209 |
:target: https://github.com/rstcheck/rstcheck/watchers/ |
| 210 |
:alt: Github - Watchers |