fix: ensure markdown text in user messages is visible (#108)

The prose plugin was overriding text colors for markdown elements
(bold, headings, etc.) in user message bubbles, causing text to
blend with the dark primary background.

Added conditional styling that forces all child elements in user
messages to use text-primary-foreground color with !important to
override prose defaults.
This commit is contained in:
Dayuan Jiang
2025-12-05 23:16:59 +09:00
committed by GitHub
parent 3f35c52527
commit 96a1111654

View File

@@ -406,7 +406,11 @@ export function ChatMessageDisplay({
switch (part.type) { switch (part.type) {
case "text": case "text":
return ( return (
<div key={index} className="prose prose-sm dark:prose-invert max-w-none break-words [&>*:first-child]:mt-0 [&>*:last-child]:mb-0"> <div key={index} className={`prose prose-sm max-w-none break-words [&>*:first-child]:mt-0 [&>*:last-child]:mb-0 ${
message.role === "user"
? "[&_*]:!text-primary-foreground prose-code:bg-white/20"
: "dark:prose-invert"
}`}>
<ReactMarkdown>{part.text}</ReactMarkdown> <ReactMarkdown>{part.text}</ReactMarkdown>
</div> </div>
); );