Skip to content

fix(chat): add h1-h6 and hr ReactMarkdown overrides#67

Open
KDwevedi wants to merge 1 commit into
amul-devfrom
fix/markdown-render-fallbacks
Open

fix(chat): add h1-h6 and hr ReactMarkdown overrides#67
KDwevedi wants to merge 1 commit into
amul-devfrom
fix/markdown-render-fallbacks

Conversation

@KDwevedi
Copy link
Copy Markdown
Collaborator

Problem

card-bubble.tsx renders chat answers via react-markdown@10 + remark-gfm@4 with component overrides for p, ol, ul, li, strong, and (as of #65) the full table family — but not h1–h6 or hr.

With Tailwind's preflight reset:

  • ### heading flattens to body text<h3> inherits base size/weight, so the section structure the agent intended is visually invisible.
  • *** renders as a near-invisible <hr>.

Evidence (Shridhar OSS eval, sme_review_400)

40 chat answers emit ### headings (chat 141, 57, 197, 10, 16, 19, 25, 49, 60, 74, 93, 94, …) that currently present with zero emphasis to the farmer. Tables already render correctly after #65; voice is plain prose (unaffected).

Change

Adds h1–h6 overrides (rendered as bold paragraphs, tiered by level, compact spacing to match the bubble) and a visible hr. Purely additive, matches the existing override style.

This is the defensive half of the fix. The root-cause half is backend PR OpenAgriNet/amul-oan-api#65, which steers the agent away from headings/tables/HR/LaTeX entirely. This PR ensures graceful degradation if such Markdown still reaches the UI.

Validation

Visual-only, additive. Recommend a dev smoke rendering one heading-heavy answer (e.g. chat 141) to confirm tiered bold paragraphs + visible HR.

🤖 Generated with Claude Code

card-bubble overrides p/ol/ul/li/strong/table* but not headings or
hr. With Tailwind preflight, `### heading` flattens to body text
(heading hierarchy lost) and `***` renders as a near-invisible rule.

Adds compact, bubble-styled h1-h6 (rendered as bold paragraphs,
tiered by level) and a visible hr. Defensive complement to the
backend prompt change that steers the agent away from headings/
tables/HR; this ensures graceful degradation if such Markdown
still reaches the UI.

Eval evidence (Shridhar OSS eval): 40 chat answers emit ###
headings that currently render with zero visual emphasis.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.

1 participant