Skip to content

fix(assistant): render <br> and wrap the share banner - #252

Draft
omznc wants to merge 3 commits into
mainfrom
fix/shared-chat-mobile
Draft

omznc wants to merge 3 commits into
mainfrom
fix/shared-chat-mobile

Conversation

@omznc

@omznc omznc commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

Problem

  • The model writes <br> for a line break, for example in a poem or a table cell. The inline parsers do not read HTML, so the chat showed <br> as text.
  • On a phone, the banner of a shared chat put the text and the buttons in one row. The text became a narrow column.

Change

  • renderInline (web) and parseInline (mobile) change each <br> to a line break after the inline split. An italic span over a <br> stays one span. A <br> inside a code span stays literal.
  • On web, headings, list items and table cells use whitespace-pre-line (a no-wrap column uses whitespace-pre), so the break shows there too, not only in paragraphs.
  • The text group of the banner has a minimum width of min(100%, 20rem), so the buttons wrap to their own row on a phone.

Test

  • parseInline tests in markdown.test.ts, including the code-span case.
  • A new answer-br.test.tsx: a <br> in a table cell breaks, and a <br> in a code span stays literal. Both fail on the code before the fix.
  • I checked the shared chat page at the Pixel 7 size on the dev server.

Limits

  • A malformed code span with an unmatched leading backtick also keeps its <br> as text.

The model writes <br> for a line break, for example in a poem. The
inline parsers of the web app and the mobile app do not read HTML, so
the chat showed the tag as text. Both parsers now change a <br> to a
line break after the inline split, so an italic span over a <br>
stays one span.

On a phone, the banner of a shared chat put the text and the buttons
in one row, and the text became a narrow column. The text group now
has a minimum width, so the buttons wrap to their own row.
The BR constant sat between the doc comment and renderInline. Move the constant above the comment so the comment documents the function.
The <br> replacement gave a newline, but only the plain paragraph
showed it. Table cells, list items and headings collapsed it to a
space. Add whitespace-pre-line to those wrappers. A no-wrap table
column uses whitespace-pre, which keeps the break and the no-wrap.

The replacement also ran inside inline code spans. Skip a code part
on web and on mobile, so `a<br>b` stays literal.
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