Md

Parser for Markdown/MyST.

Yuio supports all CommonMark features except tables. It also supports directives and interpreted text via MyST syntax.

Supported block markup:

  • headings,

  • numbered and bullet lists,

  • code blocks using backticks and indentation,

  • MyST-style code blocks using colons,

  • code blocks containing MyST directives,

  • quotes,

  • hyperlink targets,

  • 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`),

  • inline math ($math$),

  • MyST-style interpreted text ({role}`content`),

  • hyperlinks ([text](link), [text][anchor], [anchor]) in terminals that can render them,

  • backslash-escaping.

Supported inline roles:

  • flag for 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.md.parse(text: str, /, *, dedent: bool = True) Document

Parse a markdown 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.md.MdParser

Parses subset of CommonMark/MyST.