LemonChannels.Telegram.Markdown (lemon_channels v0.1.0)

View Source

Renders CommonMark-ish markdown into Telegram-ready {text, entities} tuples.

Instead of using Telegram MarkdownV2 escaping, this module parses markdown via EarmarkParser, emits plain text, and attaches Telegram "entities" with UTF-16 offsets and lengths. Supported entity types: bold, italic, underline, strikethrough, code, pre, and text_link.

Summary

Functions

Render a markdown string into {plain_text, entities} for the Telegram Bot API.

Types

entity()

@type entity() :: map()

Functions

render(md)

@spec render(String.t() | nil) :: {String.t(), [entity()]}

Render a markdown string into {plain_text, entities} for the Telegram Bot API.

Returns {"", []} when given nil.