LemonChannels.Telegram.Formatter (lemon_channels v0.1.0)

View Source

Formats markdown for Telegram in a robust way.

We avoid Telegram's MarkdownV2 escaping (fragile) and instead render markdown into plain text with Telegram entities (UTF-16 offsets) for formatting.

Summary

Functions

Prepare markdown text for Telegram.

Functions

prepare_for_telegram(text)

@spec prepare_for_telegram(String.t() | nil) :: {String.t(), map() | nil}

Prepare markdown text for Telegram.

Returns {text, opts} where opts is a map suitable for passing to the Telegram API's send_message/edit_message_text calls.