Skip to content

fix: render markdown bold/italic/code in Telegram messages#338

Merged
asheshgoplani merged 1 commit intoasheshgoplani:mainfrom
BestSithInEU:fix/telegram-markdown-bold
Mar 16, 2026
Merged

fix: render markdown bold/italic/code in Telegram messages#338
asheshgoplani merged 1 commit intoasheshgoplani:mainfrom
BestSithInEU:fix/telegram-markdown-bold

Conversation

@BestSithInEU
Copy link
Copy Markdown
Contributor

Summary

Conductor responses use markdown formatting (**bold**, *italic*, `code`) but Telegram renders them as raw text with visible asterisks.

Changes

  • Add md_to_tg_html() helper in conductor/bridge.py that:
    • Escapes HTML special chars (<, >, &)
    • Converts **bold**<b>bold</b>
    • Converts *italic*<i>italic</i>
    • Converts `code`<code>code</code>
  • Apply to interactive Telegram responses (message.answer)
  • Apply to heartbeat NEED: alert notifications (bot.send_message)
  • Both use parse_mode="HTML"

Before / After

Before: NEED: **main** — awaiting decision
After: NEED: main — awaiting decision

Test plan

  • Tested on live Telegram bot — bold renders correctly
  • Heartbeat NEED: alerts render with bold session names
  • Special chars in responses (<, >) are escaped properly

Copilot AI review requested due to automatic review settings March 15, 2026 10:30
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Telegram bridge so Conductor responses that contain simple markdown (**bold**, *italic*, `code`) render correctly in Telegram by converting them to Telegram’s HTML parse mode.

Changes:

  • Added md_to_tg_html() in conductor/bridge.py to escape HTML-sensitive characters and convert basic markdown to Telegram HTML tags.
  • Applied HTML conversion + parse_mode="HTML" to interactive Conductor replies sent via message.answer(...).
  • Applied HTML conversion + parse_mode="HTML" to heartbeat NEED alert notifications sent via bot.send_message(...).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Conductor responses use markdown formatting (**bold**, *italic*, `code`)
but Telegram displays them as raw text. Add md_to_tg_html() helper that
converts markdown to Telegram HTML and escapes unsafe characters.

Applied to both interactive responses and heartbeat NEED: alerts.
@BestSithInEU BestSithInEU force-pushed the fix/telegram-markdown-bold branch from a3b4219 to 26d8399 Compare March 15, 2026 10:34
@asheshgoplani asheshgoplani merged commit 7082b6f into asheshgoplani:main Mar 16, 2026
BestSithInEU added a commit to BestSithInEU/agent-deck that referenced this pull request Mar 18, 2026
PR asheshgoplani#338 added markdown-to-HTML conversion for Telegram messages in
conductor/bridge.py, but the embedded copy in conductor_templates.go
was not updated. This meant `conductor setup` would overwrite bridge.py
with the unfixed version, losing bold/italic/code rendering in Telegram.

Adds md_to_tg_html() and parse_mode="HTML" to both the handle_message
response path and the heartbeat Telegram notification path in the
embedded template, matching the standalone bridge.py fix.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants