Skip to content

fix(telegram): escape backslashes and backticks inside code entities for Telegram (MarkdownV2) - #2200

Merged
teknium1 merged 1 commit into
NousResearch:mainfrom
llbn:fix/telegram-mdv2-code-backslash
Mar 20, 2026
Merged

fix(telegram): escape backslashes and backticks inside code entities for Telegram (MarkdownV2)#2200
teknium1 merged 1 commit into
NousResearch:mainfrom
llbn:fix/telegram-mdv2-code-backslash

Conversation

@llbn

@llbn llbn commented Mar 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • escape \\\ inside inline code and fenced code blocks per MarkdownV2 spec
  • escape `\` inside fenced code block bodies, preserving ``` delimiters
  • add 4 regression tests covering backslashes in inline code, backslashes and backticks in fenced blocks, and double-escape prevention

Testing

./.venv/bin/python -m pytest tests/gateway/test_telegram_format.py -q

Fixes #2193

…for MarkdownV2

- Escape \ → \\ inside inline code and fenced code blocks
- Escape ` → \` inside fenced code block bodies (not delimiters)
- Add regression tests for code entity backslash handling
@teknium1
teknium1 merged commit ca03358 into NousResearch:main Mar 20, 2026
1 check passed
@llbn
llbn deleted the fix/telegram-mdv2-code-backslash branch March 20, 2026 22:48
angelburgosrosado pushed a commit to angelburgosrosado/hermes-agent that referenced this pull request Apr 27, 2026
…-backslash

fix(telegram): escape backslashes and backticks inside code entities for Telegram (MarkdownV2)
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
…-backslash

fix(telegram): escape backslashes and backticks inside code entities for Telegram (MarkdownV2)
gweeteve pushed a commit to gweeteve/hermes-agent that referenced this pull request Jun 2, 2026
…-backslash

fix(telegram): escape backslashes and backticks inside code entities for Telegram (MarkdownV2)
waefrebeorn pushed a commit to waefrebeorn/slermes that referenced this pull request Jul 2, 2026
…-backslash

fix(telegram): escape backslashes and backticks inside code entities for Telegram (MarkdownV2)
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.

[Bug]: Backslashes stripped inside inline code and fenced code blocks on Telegram

2 participants