mirror of
https://github.com/awizemann/scarf.git
synced 2026-05-10 10:36:35 +00:00
refactor: Use MarkdownContentView in rich chat bubbles
Replace inline AttributedString(markdown:) in RichMessageBubble with the shared MarkdownContentView for consistent styled rendering of headers, lists, blockquotes, and inline formatting in chat messages. Code blocks continue to use CodeBlockView with its copy button. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -76,13 +76,7 @@ struct RichMessageBubble: View {
|
|||||||
ForEach(Array(blocks.enumerated()), id: \.offset) { _, block in
|
ForEach(Array(blocks.enumerated()), id: \.offset) { _, block in
|
||||||
switch block {
|
switch block {
|
||||||
case .text(let text):
|
case .text(let text):
|
||||||
if let attributed = try? AttributedString(markdown: text, options: .init(interpretedSyntax: .inlineOnlyPreservingWhitespace)) {
|
MarkdownContentView(content: text)
|
||||||
Text(attributed)
|
|
||||||
.textSelection(.enabled)
|
|
||||||
} else {
|
|
||||||
Text(text)
|
|
||||||
.textSelection(.enabled)
|
|
||||||
}
|
|
||||||
case .code(let code, let language):
|
case .code(let code, let language):
|
||||||
CodeBlockView(code: code, language: language)
|
CodeBlockView(code: code, language: language)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user