Skip to content

miniproto.messages.parse_message_text

parse_message_text(text: str, parse_mode: str | None = None) -> ParsedMessageText

Render the supported lightweight Markdown delimiters into MTProto entities.

Parameters:

  • text (str) – Source message text, with backslashes escaping the next character.
  • parse_mode (str | None) – markdown/markdown-lite/md enables parsing; None, plain, text, and none preserve text verbatim.

Returns:

  • ParsedMessageText – Rendered text and entities whose offsets and lengths use UTF-16 code units.

Raises:

  • ValueError – If parse_mode is not a supported spelling.