-
-
Notifications
You must be signed in to change notification settings - Fork 69.5k
BlueBubbles: stripMarkdown regex too aggressive — strips underscores inside words #46185
Description
Bug
The stripMarkdown function used in BlueBubbles outbound text processing (extensions/bluebubbles/src/send.ts) strips single underscores that appear inside words, treating them as markdown italic delimiters when they are not.
Steps to Reproduce
- Send a message containing underscores between words, e.g.
here_is_a_message_with_underscores - The recipient sees
hereisamessagewithunderscores— all underscores stripped
Expected Behavior
Underscores inside words (no surrounding whitespace) should be preserved. Only underscores that look like actual markdown italic formatting (_some text_) should be stripped.
Actual Behavior
The regex on line 43346 of the reply bundle:
result.replace(/(?<!_)_(?!_)(.+?)(?<!_)_(?!_)/g, "$1");Matches _is_, _a_, _message_, etc. inside here_is_a_message_with_underscores and strips the underscores.
Root Cause
stripMarkdown is imported from openclaw/plugin-sdk/bluebubbles and called unconditionally in send.ts line 371. There is no config option to disable it.
Suggested Fix
The italic underscore regex should require word boundaries or whitespace around the underscore delimiters, matching how CommonMark spec handles intra-word underscores. For example:
// Only match _text_ when underscores are at word boundaries
result.replace(/(?<=\s|^)_(?!_)(.+?)(?<!_)_(?=\s|$|[.,;:!?)])/g, "$1");Alternatively, consider adding a channels.bluebubbles.markdown.strip config toggle (default: true for backwards compatibility) so operators can disable stripping entirely for channels like iMessage that render plain text anyway.
Environment
- OpenClaw 2026.3.13
- Channel: BlueBubbles (iMessage)
- macOS