Skip to main content

Checks syntax of reStructuredText and code blocks nested within it.

Project description

Build status

Checks syntax of reStructuredText and code blocks nested within it.

Installation

From pip:

$ pip install --upgrade rstcheck

Supported languages in code blocks

  • Bash

  • C (C99)

  • C++ (C++11)

  • JSON

  • Python

  • reStructuredText

Examples

With bad Python syntax:

====
Test
====

.. code-block:: python

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

With bad C++ syntax:

====
Test
====

.. code-block:: cpp

    int main()
    {
        return x;
    }
$ 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:

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

Options

usage: rstcheck [-h] [--report level] [--ignore language] files [files ...]

Checks code blocks in reStructuredText.

positional arguments:
  files              files to check

optional arguments:
  -h, --help         show this help message and exit
  --report level     report system messages at or higher than level; 1 info, 2
                     warning, 3 error, 4 severe, 5 none (default: 1)
  --ignore language  comma-separated list of languages to ignore

Configuration

If your project has custom roles and directives, you can specify them in the local configuration of project. rstcheck looks for a file .rstcheck.cfg in the directory where it was launched.

For example, you have the following directory structure:

docs
├── foo
│   └── bar.rst
├── index.rst
└── .rstcheck.cfg

.rstcheck.cfg contains:

[roles]
ignore=src,RFC

[directives]
ignore=one,two,three

bar.rst contains:

Bar
===

:src:`hello_world.py`
:RFC:`793`

.. one::

   Hello

Run rstcheck from the appropriate directory:

$ cd docs
$ rstcheck foo/bar.rst

Usage in Vim

To check reStructuredText in Vim using Syntastic:

let g:syntastic_rst_checkers = ['rstcheck']

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rstcheck-1.1.1.tar.gz (7.4 kB view details)

Uploaded Source

File details

Details for the file rstcheck-1.1.1.tar.gz.

File metadata

  • Download URL: rstcheck-1.1.1.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for rstcheck-1.1.1.tar.gz
Algorithm Hash digest
SHA256 b989a5f2cf51147200af4f0b3f64557f95ab4478421537ef32c4445ebc196960
MD5 bd81b27cecdb7567c66d20ad58489784
BLAKE2b-256 ea4a2ed12fb9ce9f1fc8f61935d0defe58eae61fcaaf68af82d3509b974fc422

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page