commit 93798ea79e789366fa66c2f349f8f62b30ca1a7e
parent 366d46dfabd0060c93426cf040900d5592214994
Author: William Casarin <jb55@jb55.com>
Date: Fri, 18 Nov 2022 12:32:56 -0800
Removing markdown breaks other things so revert for now
This reverts commit 366d46dfabd0060c93426cf040900d5592214994.
Diffstat:
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/damus/Views/NoteContentView.swift b/damus/Views/NoteContentView.swift
@@ -11,7 +11,7 @@ struct NoteArtifacts {
let content: String
let images: [URL]
let invoices: [Invoice]
-
+
static func just_content(_ content: String) -> NoteArtifacts {
NoteArtifacts(content: content, images: [], invoices: [])
}
@@ -39,7 +39,7 @@ func render_note_content(ev: NostrEvent, profiles: Profiles, privkey: String?) -
return str + url.absoluteString
}
}
-
+
return NoteArtifacts(content: txt, images: img_urls, invoices: invoices)
}
@@ -52,15 +52,21 @@ struct NoteContentView: View {
let privkey: String?
let event: NostrEvent
let profiles: Profiles
-
+
let show_images: Bool
-
+
@State var artifacts: NoteArtifacts
-
+
func MainContent() -> some View {
+ let md_opts: AttributedString.MarkdownParsingOptions =
+ .init(interpretedSyntax: .inlineOnlyPreservingWhitespace)
+
return VStack(alignment: .leading) {
- Text(artifacts.content)
-
+ if let txt = try? AttributedString(markdown: artifacts.content, options: md_opts) {
+ Text(txt)
+ } else {
+ Text(artifacts.content)
+ }
if show_images && artifacts.images.count > 0 {
ImageCarousel(urls: artifacts.images)
}
@@ -70,7 +76,7 @@ struct NoteContentView: View {
}
}
}
-
+
var body: some View {
MainContent()
.onAppear() {