Browse Source

Removing markdown breaks other things so revert for now

This reverts commit 366d46dfab.
profile-edit
William Casarin 2 years ago
parent
commit
93798ea79e
  1. 22
      damus/Views/NoteContentView.swift

22
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() {

Loading…
Cancel
Save