Skip to main content

parse_html

Function parse_html 

Source
pub fn parse_html(html: &str) -> (String, Vec<MessageEntity>)
Expand description

Parse a Telegram-compatible HTML string into (plain_text, entities).

Supported tags:

  • <b> / <strong> → Bold
  • <i> / <em> → Italic
  • <u> → Underline
  • <s> / <del> / <strike> → Strikethrough
  • <code> → Code (inside <pre> → Pre with language)
  • <pre> → Pre block
  • <tg-spoiler> → Spoiler
  • <a href="..."> → TextUrl or MentionName
  • <tg-emoji emoji-id="..."> → CustomEmoji