Markdown tables display as plain text instead of formatted tables
Description
Description
When OpenCode generates a response containing markdown table syntax, the tables are not being rendered as formatted ASCII/text tables in the terminal output. Instead, the raw markdown syntax is displayed.
Expected Behavior
When the AI assistant outputs a comparison table or any tabular data, it should render as a properly formatted text-based table with borders and alignment in the terminal.
Actual Behavior
The raw markdown table syntax is displayed as-is in the terminal, making it difficult to read the comparison data.
Additional Context
- Tested with GitHub Copilot provider
- Using OpenCode version 1.0.16
- Mac OS 26.0.1 with Kitty terminal
OpenCode version
1.0.16
Steps to reproduce
- Go to model selector
- Select any model that you have active subscription to (tested with GitHub Copilot)
- Ask it to output a comparison table (e.g., "compare GPT-4 vs Claude")
- Raw markdown text gets displayed instead of formatted table
Screenshot and/or share link
Operating System
Mac os 26.0.1
Terminal
Kitty terminal
This issue might be a duplicate of existing issues. Please check:
- #2166: Reports markdown table rendering inconsistencies and asks about theming support for table display
Feel free to ignore if none of these address your specific case.
Hi, I started tinkering as this issue was bothering me recently. I'll be happy to take a crack at it, but there is a design decision to make here, both in regards to styling and in regards to handling of tables that overflow
In general I thought to follow a similar direction to the way markdown renders work in nvim. Turning something like this:
To this:
The problem is with large tables.
In raw form they currently render like this: (messed up but somewhat readable)
One possible direction to take here is to truncate columns based on the terminal's width:
But then that require "teaching" the user to turn off code concealement to see the full text (which can be added as a hint below a truncated table)
But maybe there is a better direction I'm missing. I thought of horizontal scrolling but that seems very unintuitive (and I'm not sure how well it works in terminals). Another option is just to truncate whole columns and leave only the first and last columns - but that feels too disruptive and will force the user to turn off concealement every time.
In regards to styling - I honestly like the plain style. But I can see a potential to extend the themes with colors and styles for headings, seperators, etc.
Anyways - I'm just playing around. If you would like me to continue in this direction and open a PR, let me know and I'll be happy to help.
+1 probably the best way to implement it is to toggle with a shortcut the markdown/text rendering
+1
Working on a PR in opentui https://github.com/sst/opentui/pull/369
Seems like copilot cli can't handle overflowing tables as well. In this case, I wonder if it's technically possible to let table occupy full width(or not) and then wrap lines in cells. Like how glow does it:
Hi, does anyone found out how to fix this bug on the table rendering ? It is been there for a while. thanks
Same issue.
Example output:
Example of what it should look like imo:
Environment: Multiple (both native Linux clients + Windows 11 with WSL), both when running locally and when running on a different host (ssh). OpenCode 1.0.168 with Claude.
Would be fantastic if this was fixed.
Temporary workaround
Until a fix is implemented, I have created a workaround based on my previous comment. Instruct your agents to pad table contents with something like this:
When outputting markdown tables, always pad cell contents so that all cells in the same column have exactly the same character width.
I've added it myself to my CLAUDE.md.
Temporary workaround
Until a fix is implemented, I have created a workaround based on my previous comment. Instruct your agents to pad table contents with something like this:
When outputting markdown tables, always pad cell contents so that all cells in the same column have exactly the same character width.I've added it myself to my
CLAUDE.md.
I think there's https://github.com/franlol/opencode-md-table-formatter for that.
I think there's https://github.com/franlol/opencode-md-table-formatter for that.
Fantastic, thanks! I didn't fancy the output for the separator in tables too much, so I forked it and created my own to mimic my desired output from the latest screenshot above.
https://github.com/eivamu/opencode-md-table-formatter