From 419f409d983a2e6dc38a3ea1432f28b8ec3cfcda Mon Sep 17 00:00:00 2001 From: Mikhail Kilin Date: Thu, 21 May 2026 15:37:04 +0300 Subject: [PATCH] Render iOS message markdown --- .../TeleTuiIOS/Sources/TeleTuiIOSCore/Views.swift | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/apps/ios/TeleTuiIOS/Sources/TeleTuiIOSCore/Views.swift b/apps/ios/TeleTuiIOS/Sources/TeleTuiIOSCore/Views.swift index 571079c..59c9c29 100644 --- a/apps/ios/TeleTuiIOS/Sources/TeleTuiIOSCore/Views.swift +++ b/apps/ios/TeleTuiIOS/Sources/TeleTuiIOSCore/Views.swift @@ -526,7 +526,7 @@ public struct MessageRow: View { .font(.caption) .foregroundStyle(.secondary) } - Text(message.text) + Text(renderedText) .textSelection(.enabled) if !message.reactions.isEmpty { Text(message.reactions.map(\.emoji).joined(separator: " ")) @@ -552,6 +552,17 @@ public struct MessageRow: View { } } } + + private var renderedText: AttributedString { + ( + try? AttributedString( + markdown: message.text, + options: AttributedString.MarkdownParsingOptions( + interpretedSyntax: .inlineOnlyPreservingWhitespace + ) + ) + ) ?? AttributedString(message.text) + } } public struct ComposeBar: View {