From 2fdf5fe23937bf1623575e0fe4c661d1ba4ef05d Mon Sep 17 00:00:00 2001 From: Thomas Ricouard Date: Fri, 13 Jan 2023 14:11:21 +0100 Subject: [PATCH] Fix markdown rendering for statuses --- Packages/Models/Sources/Models/Alias/HTMLString.swift | 3 +-- .../Status/Sources/Status/Editor/StatusEditorViewModel.swift | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Packages/Models/Sources/Models/Alias/HTMLString.swift b/Packages/Models/Sources/Models/Alias/HTMLString.swift index ea954f55..e5f5792e 100644 --- a/Packages/Models/Sources/Models/Alias/HTMLString.swift +++ b/Packages/Models/Sources/Models/Alias/HTMLString.swift @@ -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) } diff --git a/Packages/Status/Sources/Status/Editor/StatusEditorViewModel.swift b/Packages/Status/Sources/Status/Editor/StatusEditorViewModel.swift index b075fb9f..0b4010e3 100644 --- a/Packages/Status/Sources/Status/Editor/StatusEditorViewModel.swift +++ b/Packages/Status/Sources/Status/Editor/StatusEditorViewModel.swift @@ -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