← Back to PRs

#12257: fix(mattermost): default table mode to 'off' for native Markdown rendering

by mcaxtr open 2026-02-09 02:31 View on GitHub →
size: S trusted-contributor experienced-contributor
## 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