Fix markdown rendering for statuses

This commit is contained in:
Thomas Ricouard 2023-01-13 14:11:21 +01:00
parent 03b304c58d
commit 2fdf5fe239
2 changed files with 2 additions and 3 deletions

View File

@ -46,10 +46,9 @@ extension HTMLString {
public var asSafeAttributedString: AttributedString {
do {
let markdown = asMarkdown
let options = AttributedString.MarkdownParsingOptions(allowsExtendedAttributes: true,
interpretedSyntax: .inlineOnlyPreservingWhitespace)
return try AttributedString(markdown: markdown, options: options)
return try AttributedString(markdown: self, options: options)
} catch {
return AttributedString(stringLiteral: self)
}

View File

@ -150,7 +150,7 @@ public class StatusEditorViewModel: ObservableObject {
self.visibility = visibility
selectedRange = .init(location: statusText.string.utf16.count, length: 0)
case let .edit(status):
statusText = .init(status.content.asSafeAttributedString)
statusText = .init(status.content.asMarkdown.asSafeAttributedString)
selectedRange = .init(location: statusText.string.utf16.count, length: 0)
spoilerOn = !status.spoilerText.isEmpty
spoilerText = status.spoilerText