Skip to content

[WIP] Improve chat UI to render assistant markdown/tables correctly#120

Draft
Codex wants to merge 2 commits into
mainfrom
codex/improve-chat-ui-markdown-rendering
Draft

[WIP] Improve chat UI to render assistant markdown/tables correctly#120
Codex wants to merge 2 commits into
mainfrom
codex/improve-chat-ui-markdown-rendering

Conversation

@Codex
Copy link
Copy Markdown
Contributor

@Codex Codex AI commented May 16, 2026

Thanks for asking me to work on this. I will get started on it and keep this PR's description up to date as I form a plan and make progress.


This section details on the original issue you should resolve

<issue_title>Chat UI: render assistant markdown/tables in a table-friendly, safe way</issue_title>
<issue_description>Summary
Improve the dashboard chat UI so AI responses that contain markdown-style tables, lists, and code blocks render as readable structured content instead of escaped plain text with line breaks.

Current behavior

  • Assistant chat responses are currently rendered as escaped text with newline-to-
    conversion.
  • As a result, markdown/GFM table output like pipe tables displays as raw text instead of a real table.
  • This makes link/counter/history summaries much harder to read than the rest of the dashboard, which already has usable table styling.

Why

  • The model already produces table-like markdown for some answers.
  • The problem is largely presentation, not just prompting.
  • Better rendering would make AI answers more usable for diagnostics without forcing the model to invent ad hoc pseudo-layouts.

Requirements

  • Assistant responses should support a safe subset of markdown/rich rendering suitable for chat answers.
  • GFM-style tables should render as real HTML tables when present.
  • Lists, inline code, fenced code blocks, and basic emphasis should render cleanly.
  • Rendering must be safe against untrusted model output; raw output should not be injected unsafely into the DOM.
  • Chat tables should be readable on both desktop and narrow/mobile widths, including overflow handling where needed.
  • The worker can choose the exact renderer/library, but a markdown parser plus sanitization is the expected direction.
  • Reuse existing dashboard table styling where practical so chat tables feel native to the current UI.

Research notes

  • The current chat renderer in dashboard.html escapes message text and replaces newlines with
    , so markdown tables can never render as tables.
  • markdown-it supports GFM tables by default.
  • Marked is also viable, but its own docs explicitly warn that output must be sanitized.
  • DOMPurify is a strong fit for sanitizing rendered HTML before insertion.

Suggested direction

  • Parse assistant messages as markdown (assistant only; user messages can remain plain text).
  • Sanitize the rendered HTML before inserting it.
  • Add CSS/container treatment so chat tables scroll horizontally instead of blowing up the layout on narrow screens.
  • Keep copy-to-clipboard behavior working on the raw assistant text.

Non-goals

  • Do not build a full rich text editor or custom document renderer.
  • Do not over-design special AI-only table components unless the markdown path proves insufficient.
  • Do not allow unsafe raw HTML from model output.

Acceptance criteria

  • A pipe-table markdown response renders as an actual table in the chat panel.
  • Basic markdown elements (lists, code blocks, inline code, emphasis) render correctly for assistant responses.
  • Rendered output is sanitized before insertion into the DOM.
  • Chat remains usable on mobile/narrow widths when tables are present.
  • At least one regression test or manual validation path covers table rendering.

Notes
This should stay at the requirements level. The implementing worker can decide the smallest viable renderer/sanitizer integration and whether this lands in one pass or as a small series of follow-ups.</issue_description>

Comments on the Issue (you are @codex[agent] in this section)

Co-authored-by: DarinShapiro <23219821+DarinShapiro@users.noreply.github.com>
@Codex Codex AI requested a review from DarinShapiro May 16, 2026 06:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Chat UI: render assistant markdown/tables in a table-friendly, safe way

2 participants