Fixed propper MD rendering +++++
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user