Removing markdown breaks other things so revert for now
This reverts commit 366d46dfab.
This commit is contained in:
@@ -11,7 +11,7 @@ struct NoteArtifacts {
|
|||||||
let content: String
|
let content: String
|
||||||
let images: [URL]
|
let images: [URL]
|
||||||
let invoices: [Invoice]
|
let invoices: [Invoice]
|
||||||
|
|
||||||
static func just_content(_ content: String) -> NoteArtifacts {
|
static func just_content(_ content: String) -> NoteArtifacts {
|
||||||
NoteArtifacts(content: content, images: [], invoices: [])
|
NoteArtifacts(content: content, images: [], invoices: [])
|
||||||
}
|
}
|
||||||
@@ -39,7 +39,7 @@ func render_note_content(ev: NostrEvent, profiles: Profiles, privkey: String?) -
|
|||||||
return str + url.absoluteString
|
return str + url.absoluteString
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NoteArtifacts(content: txt, images: img_urls, invoices: invoices)
|
return NoteArtifacts(content: txt, images: img_urls, invoices: invoices)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,15 +52,21 @@ struct NoteContentView: View {
|
|||||||
let privkey: String?
|
let privkey: String?
|
||||||
let event: NostrEvent
|
let event: NostrEvent
|
||||||
let profiles: Profiles
|
let profiles: Profiles
|
||||||
|
|
||||||
let show_images: Bool
|
let show_images: Bool
|
||||||
|
|
||||||
@State var artifacts: NoteArtifacts
|
@State var artifacts: NoteArtifacts
|
||||||
|
|
||||||
func MainContent() -> some View {
|
func MainContent() -> some View {
|
||||||
|
let md_opts: AttributedString.MarkdownParsingOptions =
|
||||||
|
.init(interpretedSyntax: .inlineOnlyPreservingWhitespace)
|
||||||
|
|
||||||
return VStack(alignment: .leading) {
|
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 {
|
if show_images && artifacts.images.count > 0 {
|
||||||
ImageCarousel(urls: artifacts.images)
|
ImageCarousel(urls: artifacts.images)
|
||||||
}
|
}
|
||||||
@@ -70,7 +76,7 @@ struct NoteContentView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
MainContent()
|
MainContent()
|
||||||
.onAppear() {
|
.onAppear() {
|
||||||
|
|||||||
Reference in New Issue
Block a user