Skip to content

fix(web): preserve user prompt line breaks#804

Open
swear01 wants to merge 2 commits into
tiann:mainfrom
swear01:fix/issue-794-preserve-user-line-breaks
Open

fix(web): preserve user prompt line breaks#804
swear01 wants to merge 2 commits into
tiann:mainfrom
swear01:fix/issue-794-preserve-user-line-breaks

Conversation

@swear01
Copy link
Copy Markdown
Contributor

@swear01 swear01 commented Jun 4, 2026

Closes #794

Summary

  • Preserve single newlines in sent user prompt bubbles so Shift+Enter input displays as typed.
  • Add an opt-in markdown plugin list with remark-breaks for user-authored prompt rendering only.
  • Keep assistant/tool markdown rendering on the existing shared plugin list.

Root cause

User bubbles render through the markdown pipeline. Standard Markdown collapses single newlines unless remark-breaks or explicit hard breaks are used, while queued message previews use whitespace-pre-wrap.

Test plan

  • git diff --check upstream/main..HEAD
  • bun run --cwd web test src/components/AssistantChat/messages/user-bubble.test.tsx src/components/assistant-ui/markdown-text.test.ts
  • bun run --cwd web typecheck
  • bun run --cwd web test
  • Manual HAPI test env from .git/info/hapi-local-notes.md: sent a multi-line user prompt and verified the user bubble preserves line breaks.

Pre-PR checks

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Findings

  • No issues found with confidence >= 80% in the added or modified lines.

Summary

  • Review mode: initial
  • The change keeps hard-break parsing scoped to user prompt bubbles via preserveSingleLineBreaks, while assistant/tool markdown paths continue to use MARKDOWN_PLUGINS without remark-breaks.
  • Residual risk: visual newline rendering is covered mostly through prop/plugin wiring, not a DOM-level assertion of rendered <br> output.

Testing

  • Not run (automation: bun not found on PATH in this runner)

HAPI Bot

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.

bug(web): user prompt line breaks not rendered in chat bubble

1 participant