Fixed propper MD rendering +++++

This commit is contained in:
2026-02-12 18:44:39 +01:00
parent 7265d22438
commit abd1dfddd4
13 changed files with 175 additions and 20 deletions

View File

@@ -6,6 +6,7 @@
//
import SwiftUI
import MarkdownUI
#if canImport(AppKit)
import AppKit
#endif
@@ -34,21 +35,16 @@ struct MarkdownContentView: View {
@ViewBuilder
private func markdownText(_ text: String) -> some View {
if let attrString = try? AttributedString(markdown: text, options: .init(interpretedSyntax: .full)) {
Text(attrString)
.font(.system(size: fontSize))
.foregroundColor(.oaiPrimary)
.lineSpacing(4)
.frame(maxWidth: .infinity, alignment: .leading)
.textSelection(.enabled)
} else {
Text(text)
.font(.system(size: fontSize))
.foregroundColor(.oaiPrimary)
.lineSpacing(4)
.frame(maxWidth: .infinity, alignment: .leading)
.textSelection(.enabled)
}
Markdown(text)
.markdownTextStyle {
FontSize(fontSize)
ForegroundColor(.primary)
}
.markdownBlockStyle(\.paragraph) { configuration in
configuration.label
.markdownMargin(top: 0, bottom: 8)
}
.textSelection(.enabled)
}
// MARK: - Parsing