rstcheck

Checks syntax of reStructuredText and code blocks nested within it

MIT 52 个版本 Python >=3.9
安装
pip install rstcheck
poetry add rstcheck
pipenv install rstcheck
conda install rstcheck
描述

======== rstcheck

+-------------------+---------------------------------------------------------------------------------------------+ | General | |maintenance_y| |license| |semver| | | +---------------------------------------------------------------------------------------------+ | | |rtd| | +-------------------+---------------------------------------------------------------------------------------------+ | CI | |gha_tests| |gha_docu| |gha_qa| |pre_commit_ci| | +-------------------+---------------------------------------------------------------------------------------------+ | PyPI | |pypi_release| |pypi_py_versions| |pypi_implementations| | | +---------------------------------------------------------------------------------------------+ | | |pypi_format| |pypi_downloads| | +-------------------+---------------------------------------------------------------------------------------------+ | Github | |gh_tag| |gh_last_commit| | | +---------------------------------------------------------------------------------------------+ | | |gh_stars| |gh_forks| |gh_contributors| |gh_watchers| | +-------------------+---------------------------------------------------------------------------------------------+

Checks syntax of reStructuredText and code blocks nested within it.

See the full documentation at read-the-docs_

.. contents::

Installation

From pip

.. code:: shell

$ pip install rstcheck

To use pyproject.toml for configuration::

$ pip install rstcheck[toml]

To add sphinx support::

$ pip install rstcheck[sphinx]

Supported languages in code blocks

  • Bash
  • Doctest
  • C (C99)
  • C++ (C++11)
  • JSON
  • XML
  • Python
  • reStructuredText

Examples

.. rstcheck: ignore-languages=cpp,python,rst

With bad Python syntax:

.. code:: rst

====
Test
====

.. code:: python

    print(

.. code:: text

$ rstcheck bad_python.rst
bad_python.rst:7: (ERROR/3) (python) unexpected EOF while parsing

With bad C++ syntax:

.. code:: rst

====
Test
====

.. code:: cpp

    int main()
    {
        return x;
    }

.. code:: text

$ rstcheck bad_cpp.rst
bad_cpp.rst:9: (ERROR/3) (cpp) error: 'x' was not declared in this scope

With bad syntax in the reStructuredText document itself:

.. code:: rst

====
Test
===

.. code:: text

$ rstcheck bad_rst.rst
bad_rst.rst:1: (SEVERE/4) Title overline & underline mismatch.

.. _read-the-docs: https://rstcheck.readthedocs.io

.. General

.. |maintenance_n| image:: https://img.shields.io/badge/Maintenance%20Intended-✖-red.svg?style=flat-square :target: http://unmaintained.tech/ :alt: Maintenance - not intended

.. |maintenance_y| image:: https://img.shields.io/badge/Maintenance%20Intended-✔-green.svg?style=flat-square :target: http://unmaintained.tech/ :alt: Maintenance - intended

.. |license| image:: https://img.shields.io/github/license/rstcheck/rstcheck.svg?style=flat-square&label=License :target: https://github.com/rstcheck/rstcheck/blob/main/LICENSE :alt: License

.. |semver| image:: https://img.shields.io/badge/Semantic%20Versioning-2.0.0-brightgreen.svg?style=flat-square :target: https://semver.org/ :alt: Semantic Versioning - 2.0.0

.. |rtd| image:: https://img.shields.io/readthedocs/rstcheck/latest.svg?style=flat-square&logo=read-the-docs&logoColor=white&label=Read%20the%20Docs :target: https://rstcheck.readthedocs.io/en/latest/ :alt: Read the Docs - Build Status (latest)

.. CI

.. |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 :target: https://github.com/rstcheck/rstcheck/actions/workflows/test.yaml :alt: Test status

.. |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 :target: https://github.com/rstcheck/rstcheck/actions/workflows/documentation.yaml :alt: Documentation status

.. |gha_qa| image:: https://img.shields.io/github/actions/workflow/status/rstcheck/rstcheck/qa.yml?branch=main&style=flat-square&logo=github&label=QA :target: https://github.com/rstcheck/rstcheck/actions/workflows/qa.yaml :alt: QA status

.. |pre_commit_ci| image:: https://results.pre-commit.ci/badge/github/rstcheck/rstcheck/main.svg :target: https://results.pre-commit.ci/latest/github/rstcheck/rstcheck/main :alt: pre-commit status

.. PyPI

.. |pypi_release| image:: https://img.shields.io/pypi/v/rstcheck.svg?style=flat-square&logo=pypi&logoColor=FBE072 :target: https://pypi.org/project/rstcheck/ :alt: PyPI - Package latest release

.. |pypi_py_versions| image:: https://img.shields.io/pypi/pyversions/rstcheck.svg?style=flat-square&logo=python&logoColor=FBE072 :target: https://pypi.org/project/rstcheck/ :alt: PyPI - Supported Python Versions

.. |pypi_implementations| image:: https://img.shields.io/pypi/implementation/rstcheck.svg?style=flat-square&logo=python&logoColor=FBE072 :target: https://pypi.org/project/rstcheck/ :alt: PyPI - Supported Implementations

.. |pypi_format| image:: https://img.shields.io/pypi/format/rstcheck.svg?style=flat-square&logo=pypi&logoColor=FBE072 :target: https://pypi.org/project/rstcheck/ :alt: PyPI - Format

.. |pypi_downloads| image:: https://img.shields.io/pypi/dm/rstcheck.svg?style=flat-square&logo=pypi&logoColor=FBE072 :target: https://pypi.org/project/rstcheck/ :alt: PyPI - Monthly downloads

.. GitHub

.. |gh_tag| image:: https://img.shields.io/github/v/tag/rstcheck/rstcheck.svg?sort=semver&style=flat-square&logo=github :target: https://github.com/rstcheck/rstcheck/tags :alt: Github - Latest Release

.. |gh_last_commit| image:: https://img.shields.io/github/last-commit/rstcheck/rstcheck.svg?style=flat-square&logo=github :target: https://github.com/rstcheck/rstcheck/commits/main :alt: GitHub - Last Commit

.. |gh_stars| image:: https://img.shields.io/github/stars/rstcheck/rstcheck.svg?style=flat-square&logo=github :target: https://github.com/rstcheck/rstcheck/stargazers :alt: Github - Stars

.. |gh_forks| image:: https://img.shields.io/github/forks/rstcheck/rstcheck.svg?style=flat-square&logo=github :target: https://github.com/rstcheck/rstcheck/network/members :alt: Github - Forks

.. |gh_contributors| image:: https://img.shields.io/github/contributors/rstcheck/rstcheck.svg?style=flat-square&logo=github :target: https://github.com/rstcheck/rstcheck/graphs/contributors :alt: Github - Contributors

.. |gh_watchers| image:: https://img.shields.io/github/watchers/rstcheck/rstcheck.svg?style=flat-square&logo=github :target: https://github.com/rstcheck/rstcheck/watchers/ :alt: Github - Watchers

版本列表
6.2.5 2025-06-01
6.2.4 2024-07-07
6.2.3 2024-07-07
6.2.2 2024-07-07
6.2.1 2024-03-23
6.2.0 2023-09-09
6.1.2 2023-03-12
6.1.1 2022-11-12
6.1.0 2022-08-14
6.0.0 2022-06-04
6.0.0.post1 2022-06-05
6.0.0rc3 2022-05-28
6.0.0rc2 2022-05-26
6.0.0rc1 2022-05-21
6.0.0a2 2022-05-20
6.0.0a1 2022-05-13
5.0.0 2022-04-17
4.1.0 2022-04-16
4.0.0 2022-04-15
3.5.0 2022-04-14
3.4.0 2022-04-12
3.3.1 2018-11-09
3.3 2018-03-17
3.2 2018-02-17
3.1 2017-03-08
3.0.1 2017-03-02
3.0 2016-12-19
2.2 2016-10-11
2.1 2016-10-11
2.0 2016-07-27
1.5.1 2016-03-29
1.5 2016-02-03
1.4.2 2015-12-16
1.4.1 2015-08-16
1.4 2015-06-26
1.3.1 2015-04-14
1.3 2015-04-11
1.2.1 2015-04-11
1.2 2015-04-11
1.1.1 2015-04-05
1.1 2015-04-03
1.0 2015-03-14
0.6 2014-09-25
0.5.1 2014-08-23
0.5 2014-06-01
0.4.1 2014-05-31
0.4 2014-05-24
0.3.6 2014-04-12
0.3.5 2014-01-25
0.3.4 2013-12-29
0.3.3 2013-12-28
0.3.2 2013-12-27