#12257: fix(mattermost): default table mode to 'off' for native Markdown rendering
size: S
trusted-contributor
experienced-contributor
Cluster:
Mattermost Threading Enhancements
## Summary
Fixes #12238
Mattermost natively supports Markdown tables (via markdown-it), but OpenClaw was wrapping them in fenced code blocks (triple backticks). This happened because `DEFAULT_TABLE_MODES` in `src/config/markdown-tables.ts` had no entry for `"mattermost"`, causing it to fall back to the `"code"` mode.
**Root cause**: The `DEFAULT_TABLE_MODES` map only had entries for `signal` → `"bullets"` and `whatsapp` → `"bullets"`. Any channel not in the map (including mattermost) defaulted to `"code"`, which wraps tables in triple-backtick fenced code blocks.
**Fix**: Add `["mattermost", "off"]` to `DEFAULT_TABLE_MODES`. The `"off"` mode passes Markdown through unchanged, letting Mattermost render tables natively.
- The fix is a single line addition to the default table modes map
- Users can still override via `channels.mattermost.markdown.tables` in config
- Per-account overrides also continue to work
## Test plan
- [x] Add `markdown-tables.test.ts` with 6 tests covering:
- [x] Mattermost defaults to `"off"` (native table support)
- [x] Signal defaults to `"bullets"`
- [x] WhatsApp defaults to `"bullets"`
- [x] Unknown channels default to `"code"`
- [x] Channel-level config override respected
- [x] Per-account config override respected
- [x] All 6 tests fail before fix, pass after (TDD)
- [x] `pnpm build` passes
- [x] `pnpm check` passes
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR updates the markdown table mode defaults so Mattermost no longer falls back to the "code" mode (which wraps tables in fenced code blocks). Concretely, it adds a `mattermost -> "off"` entry to `DEFAULT_TABLE_MODES` in `src/config/markdown-tables.ts`, letting Mattermost render Markdown tables natively.
It also adds a focused unit test suite (`src/config/markdown-tables.test.ts`) that verifies:
- default modes for mattermost/signal/whatsapp
- unknown channels still default to "code"
- channel-level and per-account overrides are respected
Overall, the change is isolated to the config resolution logic and its tests, and should not affect other markdown rendering paths beyond the default mode selection.
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk.
- The functional change is a single additional default mapping (`mattermost -> off`) in a narrowly-scoped config resolver. The accompanying tests exercise the intended defaulting and override behavior. No breaking API changes or risky refactors were introduced in this commit.
- No files require special attention
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#18655: fix(mattermost): preserve markdown formatting and native tables
by echo931 · 2026-02-16
88.4%
#16570: feat(mattermost): add replyToMode threading support
by FBartos · 2026-02-14
75.8%
#10027: Mattermost: fix attachment downloads (GET + private-network hosts)
by transportrefer · 2026-02-06
75.4%
#20419: fix(webchat): explicitly pass gfm and breaks options to marked.parse()
by Limitless2023 · 2026-02-18
74.3%
#20928: mattermost: add readMessages action for channel history
by hubertusgbecker · 2026-02-19
73.9%
#10081: fix(mattermost): pass requireMentionOverride to core resolver
by manchmod · 2026-02-06
73.6%
#22075: mattermost: honor account requireMention override
by armindocachada · 2026-02-20
73.5%
#23513: fix(slack): respect replyToMode=off for inline directive reply tags
by dorukardahan · 2026-02-22
73.2%
#18657: feat(mattermost): add native slash command support (refresh)
by echo931 · 2026-02-16
73.2%
#18921: fix(mattermost): register websocket listeners before emitting event...
by BinHPdev · 2026-02-17
72.8%