Skip to content

feat(discord): convert markdown tables to code blocks for proper rendering#4401

Open
airouz wants to merge 1 commit intoNousResearch:mainfrom
airouz:feat/discord-markdown-tables
Open

feat(discord): convert markdown tables to code blocks for proper rendering#4401
airouz wants to merge 1 commit intoNousResearch:mainfrom
airouz:feat/discord-markdown-tables

Conversation

@airouz
Copy link
Copy Markdown

@airouz airouz commented Apr 1, 2026

Summary

Discord does not support pipe-delimited markdown tables. They render as broken plain text, losing all structure. This PR adds an automatic converter in that detects markdown table blocks and wraps them in fenced code blocks so they display as clean ASCII tables.

Changes

  • ****: Added + helper, integrated into
  • ****: 14 tests covering basic tables, alignment markers, multiple tables, code block isolation, inline code, and edge cases

How it works

  1. Extract existing fenced code blocks → replace with placeholders (prevents modification)
  2. Detect contiguous table blocks (header + separator + rows)
  3. Strip alignment markers (, , ) from separator rows
  4. Wrap each table block in a fenced code block
  5. Restore original code blocks from placeholders

Before vs After

Before: Pipe tables render as flat broken text in Discord
After: Tables display as structured monospace ASCII tables

Test results

14/14 passed

…ering

Discord does not support pipe-delimited markdown tables — they render
as broken plain text. This adds a converter that detects table blocks
(header + separator + rows), wraps them in fenced code blocks, and
strips alignment markers so they display as clean ASCII tables.

- Protects existing fenced code blocks from modification
- Preserves non-table pipe lines, inline code, and Discord formatting
- Includes 14 tests covering basic tables, alignment markers, multiple
  tables, code block isolation, and edge cases
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant