Skip to content

fix(chatbot): keep bold links bold and highlight only known code languages - #1687

Closed
rdahis wants to merge 2 commits into
mainfrom
fix/chatbot-markdown-rendering
Closed

rdahis wants to merge 2 commits into
mainfrom
fix/chatbot-markdown-rendering

Conversation

@rdahis

@rdahis rdahis commented Sep 11, 2026 •

Copy link
Copy Markdown
Member

Problem

Chatbot answers still drop some markdown formatting on main:

  1. Bold links lose their bold. a renders through BodyText, which hardcodes fontWeight="400" and fontSize="16px". In **[documentação](url)** the link's own declaration beats the bold inherited from <strong>. A link inside a heading also shrinks back to 16px.
  2. Bold/italic override link colour. strong and em force #252A32, so [**text**](url) renders in body colour.
  3. Code blocks. Fenced code is always highlighted as SQL. highlight.js v11 throws on an unregistered language, so a block such as ```python can break the message.
  4. del and hr were unstyled, and CodeBlock's <pre> was nested inside the <pre> react-markdown emits.

Scope update

This PR originally also styled h1–h6, indented ol, set th to weight 600 and added blockquote. main fixed all of those in 75e03b1, which caused the conflict. The merge with main keeps main's version of those and leaves only the four fixes above. The diff is one file, +40/−8.

Changes (next/components/organisms/chatbot/markdown.js)

  • a inherits weight, size and line height from its context.
  • strong, em and the new del inherit colour.
  • code reads the language from className (default sql), and CodeBlock falls back to unhighlighted output when hljs.getLanguage does not know the language.
  • pre unwraps to a fragment. hr is styled.

Testing

The file passes a JSX parse check (esbuild). Not yet checked against a live thread in a running app.

Git Flow

This is the main PR. development and staging already have 75e03b1, so the PRs into them carry only this diff.

🤖 Generated with Claude Code

Chakra's CSS reset sets `h1..h6 { font-size: inherit; font-weight: inherit }`
and `margin: 0`, so the h1-h6 nodes react-markdown emits rendered as plain body
text because componentsMk had no overrides for them. Add explicit styles for all
six levels.

Also:
- `a` hardcoded fontWeight/fontSize through BodyText, so `**[link](url)**` lost
  its bold; inherit them from the surrounding context instead.
- `strong`/`em` forced #252A32, overriding link colour inside `[**text**](url)`.
- markdown table headers were fontWeight 400, unlike the tool-result tables.
- `ol` had no indent margin, unlike `ul`.
- fenced code always highlighted as SQL; read the language off the className and
  fall back to unhighlighted output when highlight.js does not know it.
- add blockquote, hr and del; stop nesting CodeBlock's <pre> inside another.
@mergify

mergify Bot commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

@rdahis esse pull request tem conflitos 😩

@mergify mergify Bot added the conflict label Sep 28, 2026
…rendering

# Conflicts:
#	next/components/organisms/chatbot/markdown.js
@rdahis rdahis changed the title fix(chatbot): style markdown headings, bold links and table headers fix(chatbot): keep bold links bold and highlight only known code languages Oct 13, 2026
@rdahis rdahis closed this Oct 13, 2026

This branch had an error being deployed

1 failed deployment
staging — 3bfed007 Deployed Oct 13, 2026 by rdahis via Cypress E2E Tests #183
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant