fix(telegram): render markdown as Telegram HTML with safe, telegram-only fallbacks#126
Merged
jamiepine merged 4 commits intospacedriveapp:mainfrom Feb 22, 2026
Conversation
Convert markdown output to Telegram-compatible HTML before sending, so bold, italic, code, links, headers, blockquotes and code blocks render properly instead of showing raw markdown characters. Every send path (text, rich messages, thread replies, streaming edits, captions, ephemeral, scheduled, broadcast) now goes through `send_formatted` which sets `ParseMode::Html` and automatically falls back to plain text if the API rejects the HTML. Only the Telegram adapter is touched — Discord and Slack are unaffected.
If Telegram rejects the HTML caption the file was silently lost. Now retry with the raw caption text so the document is always delivered.
rktmeister
pushed a commit
to rktmeister/spacebot
that referenced
this pull request
Mar 11, 2026
…fix-upstream-clean fix(telegram): render markdown as Telegram HTML with safe, telegram-only fallbacks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Telegram responses were being delivered as unrendered markdown. This PR adds Telegram-native HTML formatting and hardens fallback behavior so messages/files are still delivered reliably when Telegram rejects formatting.
What Changed
ParseMode::Html) insrc/messaging/telegram.rs.CantParseEntities).Scope / Safety
Tests
src/messaging/telegram.rsfor formatting conversion and parse-error retry gating.