Skip to content

fix(gateway): preserve intraword underscores in plain text markdown stripping#11775

Open
Ruzzgar wants to merge 1 commit into
NousResearch:mainfrom
Ruzzgar:fix/gateway-markdown-strip-aggression
Open

fix(gateway): preserve intraword underscores in plain text markdown stripping#11775
Ruzzgar wants to merge 1 commit into
NousResearch:mainfrom
Ruzzgar:fix/gateway-markdown-strip-aggression

Conversation

@Ruzzgar

@Ruzzgar Ruzzgar commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Fix gateway.platforms.helpers.strip_markdown() so underscore-based italic stripping only applies at word boundaries.

Previously, plain-text content like foo_bar_baz was treated as Markdown emphasis and collapsed to foobarbaz. This affected platform adapters that reuse the shared helper for plain-text delivery, including SMS, BlueBubbles, Feishu, and QQ.

What changed

  • Narrowed _RE_ITALIC_UNDER to avoid matching underscores inside words
  • Added focused helper tests covering:
    • valid underscore italics: _italic_ text -> italic text
    • intraword underscores remain unchanged: foo_bar_baz

Why this matters

This is a real user-facing formatting bug in plain-text platform output. It corrupts identifiers, filenames, and other underscore-delimited text even when the content is not Markdown.

Validation

Ran:

  • scripts/run_tests.sh tests/gateway/test_platform_helpers.py
  • scripts/run_tests.sh tests/gateway/test_sms.py
  • scripts/run_tests.sh tests/gateway/test_bluebubbles.py

Results:

  • test_platform_helpers: 2 passed
  • test_sms: 36 passed
  • test_bluebubbles: 45 passed

Manual smoke:

  • strip_markdown("foo_bar_baz") -> foo_bar_baz
  • strip_markdown("_italic_ text") -> italic text

@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/gateway Gateway runner, session dispatch, delivery labels Apr 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery P3 Low — cosmetic, nice to have type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants