#14940: fix(googlechat): convert Markdown formatting to Google Chat markup
channel: googlechat
stale
size: S
Cluster:
Markdown Rendering Improvements
Fixes #14825
## What
Adds a `convertMarkdownToGoogleChat()` function that converts standard Markdown formatting to Google Chat's markup syntax before sending messages.
## Why
Google Chat uses different markup than standard Markdown:
- `*bold*` (single asterisk) instead of `**bold**`
- `~strikethrough~` (single tilde) instead of `~~strikethrough~~`
- `_italic_` is the same in both
OpenClaw agents output standard Markdown, which renders as literal asterisks/tildes in Google Chat instead of formatted text.
## How
- Added `convertMarkdownToGoogleChat(text)` function with simple regex transforms:
- `**text**` → `*text*` (bold)
- `~~text~~` → `~text~` (strikethrough)
- Applied in both `sendGoogleChatMessage()` and `updateGoogleChatMessage()`
- Added 8 unit tests covering various formatting scenarios
## Testing
- [x] Added unit tests (8 new tests for the conversion function)
- [x] `pnpm check` passes (lint + format + tsgo)
- [x] `pnpm vitest run extensions/googlechat` passes (18 tests)
## AI-Assisted 🤖
This PR was built with AI assistance (Claude via OpenClaw).
- [x] Code reviewed and understood
- [x] Lightly tested
- [x] Session available on request
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR adds `convertMarkdownToGoogleChat()` in `extensions/googlechat/src/api.ts` and applies it to outbound Google Chat message send/update so `**bold**` and `~~strike~~` render using Google Chat’s single-character markup. It also adds unit tests covering basic conversion cases.
The main issue is that the converter currently rewrites markers inside inline/fenced code blocks, which can corrupt code snippets commonly produced by agents/tools. Either the implementation should skip code regions (as the comment suggests) or the comment/tests should be adjusted to reflect the real behavior.
<h3>Confidence Score: 3/5</h3>
- Mostly safe to merge, but has a correctness issue that can garble code snippets in Google Chat messages.
- Changes are localized with tests, but the markdown conversion runs inside code regions despite the comment indicating it should not, which will break common agent/tool outputs containing fenced or inline code with `**`/`~~`.
- extensions/googlechat/src/api.ts
<sub>Last reviewed commit: 2b8752f</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#15204: fix(ui): preserve angle-bracketed text in chat
by bufordtjustice2918 · 2026-02-13
77.6%
#2716: Fix #2678: markdown horizontal rules not rendering in web chat
by Ambar-13 · 2026-01-27
77.4%
#16733: fix(ui): avoid injected newlines when tool output is hidden
by jp117 · 2026-02-15
77.1%
#20441: fix: preserve newlines for markdown table rendering in WebChat
by MisterGuy420 · 2026-02-18
76.5%
#17842: Fix Google Chat media upload failure by inferring content-type from...
by Clawborn · 2026-02-16
75.7%
#3727: fix(googlechat): space type detection for modern API
by gustavozirbes · 2026-01-29
75.5%
#4249: fix(telegram): properly nest link tags inside bold/italic formatting
by pradeeppeddineni · 2026-01-29
74.7%
#15251: feat(web-fetch): send Accept: text/markdown header for Cloudflare M...
by wujieli0207 · 2026-02-13
74.5%
#3837: fix(googlechat): space events response and thread reply context
by rehanchrl · 2026-01-29
74.2%
#6521: fix: addressed style issue for chat compose and thread on mobile
by spencer-rafada · 2026-02-01
74.2%