Skip to content

fix: resolve Markdown v1 parsing failures in Telegram messages#2

Merged
rezhajulio merged 1 commit intomainfrom
fix/markdown-v1-parsing
Feb 21, 2026
Merged

fix: resolve Markdown v1 parsing failures in Telegram messages#2
rezhajulio merged 1 commit intomainfrom
fix/markdown-v1-parsing

Conversation

@rezhajulio
Copy link
Owner

Problem

Users reported raw unparsed markdown in group messages (e.g. [Baca aturan grup](url) showing as plain text instead of clickable links).

Root Cause

Two issues in Telegram's Markdown v1 parser:

  1. Parentheses in link text: Templates like [Hubungi... (mohon pertimbangkan...)]({dm_link}) had parentheses inside the [...] portion, which confuses Telegram's parser.

  2. Underscores in usernames: get_user_mention() returned raw @username without escaping. Usernames like @Sharo_Kenne contain _ which Markdown v1 interprets as italic markers, poisoning the entire message's parsing.

Fix

  • Moved parenthesized disclaimer outside the link: [Hubungi...]({dm_link}) (mohon...)
  • Added escape_markdown() to get_user_mention() and get_user_mention_by_id()
  • Updated affected test assertions

Testing

All 442 tests pass.

Two issues caused raw markdown to display instead of rendered links:

1. Parentheses in link text: Templates had '(mohon pertimbangkan...)'
   inside [...](...) link syntax, which breaks Telegram's Markdown v1
   parser. Moved the parenthesized disclaimer outside the link.

2. Underscores in usernames: get_user_mention() returned raw @username
   without escaping. Usernames like @Sharo_Kenne have underscores that
   Markdown v1 interprets as italic markers, breaking parsing for the
   entire message. Added escape_markdown() for username mentions.
@rezhajulio rezhajulio force-pushed the fix/markdown-v1-parsing branch from c71e6c7 to e34bbdd Compare February 21, 2026 12:44
@rezhajulio rezhajulio merged commit 3a38890 into main Feb 21, 2026
5 checks passed
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