Expand description
Markdown → Telegram-supported HTML subset converter.
Ported from files.md (server/pkg/txt/md.go lines 262–432, str.go lines 122–170)
by Artem Zakirullin.
Uses parser combinators (open/close/or/and/some) for inline markup.
Supported tags: */_ → <i>, **/__ → <b>,
` → <code>, ``` → <pre>, # → <b>.
Functions§
- escape_
html - Escape HTML special characters (
&,<,>). - markdown_
to_ html - Convert markdown to Telegram-supported HTML subset.
- replace_
with_ placeholders - Replace regex matches with placeholders, returning the modified string and a map of placeholder → original.
- restore_
from_ placeholders - Restore placeholders back to their original values.
- strip_
html_ tags - Strip all HTML tags from a string.