Skip to content

Conversation

@bytrangle
Copy link
Contributor

@bytrangle bytrangle commented Oct 24, 2025

Describe Your Changes

There have been various reports of new lines not being rendered in model response. I think this issue comes from the RenderMarkdown component. remark-breaks, the Remark plugin that supports line breaks is only added when prop isUser is true. isUser is only passed as true for user message. For model response, this prop is not passed to RenderMarkdown so isUser is undefined, thus preventing remark-breaks from working.

Fixes Issues

Self Checklist

  • Added relevant comments, esp in complex areas
  • Updated docs (for bug fixes / features)
  • Created issues for follow-up changes or refactoring needed

@bytrangle bytrangle marked this pull request as ready for review October 29, 2025 11:24
Copilot AI review requested due to automatic review settings October 29, 2025 11:24
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR modifies the RenderMarkdown component to always use remarkBreaks plugin for all markdown content (both user messages and model responses), removing the conditional logic that previously applied it only to user messages. This ensures consistent line break handling across all message types.

Key Changes

  • Applied remarkBreaks plugin unconditionally to all markdown content regardless of isUser prop value
  • Simplified the remarkPlugins memoization by removing the dependency on isUser
  • Added comprehensive test coverage for line break preservation in various scenarios

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
web-app/src/containers/RenderMarkdown.tsx Removed conditional remarkBreaks application, now always included in the plugin array
web-app/src/containers/tests/RenderMarkdown.test.tsx Added new test file with 4 test cases covering line break handling for model responses, user messages, different line endings, and empty lines

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@bytrangle bytrangle changed the title support remark line breaks consistently fix: Support Remark Line Breaks in Agent Response Oct 29, 2025
@Vanalite
Copy link
Contributor

This looks good, pls help to fix the tests and resolve latest conflicts, then we can have your PR merged. Thanks @bytrangle

Copy link
Contributor

@louis-jan louis-jan left a comment

Choose a reason for hiding this comment

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

LGTM

Copilot AI review requested due to automatic review settings November 3, 2025 03:18
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@louis-jan louis-jan merged commit 3c5fbb4 into janhq:dev Nov 3, 2025
17 checks passed
@github-project-automation github-project-automation bot moved this to QA in Jan Nov 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: QA

Development

Successfully merging this pull request may close these issues.

bug: Chat message view sometimes drops newline characters

3 participants