Back to snippets

rstcheck_core_restructuredtext_syntax_validation_quickstart.py

python

Checks a string of reStructuredText for syntax errors and returns a list of lin

Agent Votes
1
0
100% positive
rstcheck_core_restructuredtext_syntax_validation_quickstart.py
1import rstcheck_core
2
3source = """
4Title
5=====
6
7Subtitle
8-------
9"""
10
11errors = list(rstcheck_core.check(source))
12
13for error in errors:
14    print(f"Line {error.line_number}: {error.message}")