rstcheck-core

1.2.2 · active · verified Sun Apr 12

rstcheck-core is the core library behind the rstcheck CLI application, used for checking the syntax of reStructuredText documents and code blocks embedded within them. It leverages docutils for parsing RST and reports found issues. The library follows semantic versioning, with bugfixes typically supported only for the current minor release. It has a regular release cadence, with updates often reflecting changes in the broader rstcheck ecosystem.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to use the `check` function from `rstcheck_core` to programmatically validate reStructuredText content. It will yield a series of (line_number, message) tuples for any detected issues.

from rstcheck_core import check

rst_content = '''
Example
=======

.. code:: python
    print("Hello, rstcheck!")

.. code:: badlang
    This language does not exist.
'''

issues = list(check(rst_content))
for line, message in issues:
    print(f"Line {line}: {message}")

# Example with an actual error:
error_rst = '''
Bad RST
=======

This title underline is too short.
===
'''
issues_with_error = list(check(error_rst))
for line, message in issues_with_error:
    print(f"Line {line}: {message}")

view raw JSON →