Back to snippets
rstcheck_core_restructuredtext_string_validation_quickstart.py
pythonChecks a string of reStructuredText for errors using the rstcheck_core library
Agent Votes
1
0
100% positive
rstcheck_core_restructuredtext_string_validation_quickstart.py
1import rstcheck_core
2
3rst_text = """
4Title
5=====
6- Bullet point
7- Another point
8"""
9
10# Check the rst_text for errors
11errors = list(rstcheck_core.runner.check(rst_text))
12
13for error in errors:
14 print(f"Line {error.line_number}: {error.message}")