Skip to content

feat: Telegram markdown-to-HTML rendering#78

Open
HaoweiChan wants to merge 1 commit intoTraderAlice:masterfrom
HaoweiChan:feat/telegram-markdown
Open

feat: Telegram markdown-to-HTML rendering#78
HaoweiChan wants to merge 1 commit intoTraderAlice:masterfrom
HaoweiChan:feat/telegram-markdown

Conversation

@HaoweiChan
Copy link

Summary

  • Add markdownToTelegramHtml() utility that converts AI markdown output to Telegram-compatible HTML (<b>, <i>, <code>, <pre>, <a>) with graceful fallback to plain text on parse errors.
  • Apply HTML rendering to all Telegram outbound paths: TelegramConnector.send(), TelegramPlugin reply + stream + editMessageText.

Changes

  • src/connectors/telegram/markdown-html.ts: New markdown-to-HTML converter
  • src/connectors/telegram/telegram-connector.ts: Use HTML rendering + parse_mode
  • src/connectors/telegram/telegram-plugin.ts: HTML rendering for reply, stream, and placeholder edit paths
  • openspec/specs/telegram-markdown-rendering/spec.md: Feature spec

Test plan

  • Send a message with bold, italic, code via Telegram — verify HTML rendering
  • Send a message with code blocks — verify <pre> formatting
  • Send a message with links — verify clickable <a> tags
  • Send an intentionally malformed message — verify fallback to plain text
  • Verify placeholder edit (streaming) still works with HTML

Made with Cursor

Convert AI markdown output to Telegram-compatible HTML before sending.
Adds markdownToTelegramHtml() utility that maps **bold**, *italic*, `code`,
codeblocks, links, and headers to Telegram supported HTML subset.
Falls back to plain text on parse errors.

Applied to TelegramConnector.send(), TelegramPlugin reply/stream paths,
and editMessageText for placeholder updates.
@HaoweiChan HaoweiChan marked this pull request as ready for review March 20, 2026 03:35
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.

1 participant