opencode icon indicating copy to clipboard operation
opencode copied to clipboard

Markdown tables display as plain text instead of formatted tables

Open falcon-head opened this issue 1 month ago • 7 comments

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

  1. Go to model selector
  2. Select any model that you have active subscription to (tested with GitHub Copilot)
  3. Ask it to output a comparison table (e.g., "compare GPT-4 vs Claude")
  4. Raw markdown text gets displayed instead of formatted table

Screenshot and/or share link

Image

Operating System

Mac os 26.0.1

Terminal

Kitty terminal

falcon-head avatar Nov 03 '25 20:11 falcon-head

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.

github-actions[bot] avatar Nov 03 '25 20:11 github-actions[bot]

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:

Image

To this:

Image

The problem is with large tables.

In raw form they currently render like this: (messed up but somewhat readable)

Image

One possible direction to take here is to truncate columns based on the terminal's width:

Image

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.

maxandron avatar Nov 11 '25 15:11 maxandron

+1 probably the best way to implement it is to toggle with a shortcut the markdown/text rendering

grigio avatar Nov 17 '25 10:11 grigio

+1

H0llyW00dzZ avatar Dec 02 '25 15:12 H0llyW00dzZ

Working on a PR in opentui https://github.com/sst/opentui/pull/369

remorses avatar Dec 02 '25 17:12 remorses

Image

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:

Image

66Leo66 avatar Dec 04 '25 05:12 66Leo66

Hi, does anyone found out how to fix this bug on the table rendering ? It is been there for a while. thanks

Regboy744 avatar Dec 18 '25 23:12 Regboy744

Same issue.

Example output:

Image

Example of what it should look like imo:

Image

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.

eivamu avatar Dec 19 '25 09:12 eivamu

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.

eivamu avatar Dec 19 '25 10:12 eivamu

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.

66Leo66 avatar Dec 19 '25 10:12 66Leo66

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

eivamu avatar Dec 19 '25 10:12 eivamu