Rst¶
Parser for ReStructuredText.
Yuio supports all RST features except tables and option lists.
Supported block markup:
headings,
numbered and bullet lists,
definition lists,
field lists,
literal blocks, both indented and quoted,
line blocks,
quotes,
doctest blocks,
directives,
hyperlink targets,
footnotes,
thematic breaks.
Supported roles:
code:
code-block,sourcecode,code;admonitions:
attention,caution,danger,error,hint,important,note,seealso,tip,warning;versioning:
versionadded,versionchanged,deprecated;any other directive is rendered as un-highlighted code.
Supported inline syntax:
emphasis (
*em*),strong emphasis (
**strong*),inline code in backticks (
`code`),interpreted text (
`code`,:role:`code`),hyperlink references (
`text`_,text_,`text`__,text__) in terminals that can render them,footnotes (
[...]_),inline internal targets and substitution references are parsed correctly, but they have no effect.
Supported inline roles:
flagfor CLI flags,any other role is interpreted as documentation reference with explicit titles (
{py:class}`title <mod.Class>`) and shortening paths via tilde ({py:class}`~mod.Class`).
- yuio.rst.parse(text: str, /, *, dedent: bool = True) Document¶
Parse a ReStructuredText document and return an AST node.
- Parameters:
text – text to parse. Common indentation will be removed from this string, making it suitable to use with triple quote literals.
dedent – remove lading indent from text.
- Returns:
parsed AST node.
- final class yuio.rst.RstParser¶
Parses subset of CommonMark/MyST.