From efbf456067a1f7ab6d26f79e77f90a8674ab47ce Mon Sep 17 00:00:00 2001 From: Stefan Ceriu Date: Wed, 27 Aug 2025 17:16:14 +0300 Subject: [PATCH] Remove matrix identifier attributes from code blocks --- .../Other/HTMLParsing/AttributedStringBuilderV2.swift | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ElementX/Sources/Other/HTMLParsing/AttributedStringBuilderV2.swift b/ElementX/Sources/Other/HTMLParsing/AttributedStringBuilderV2.swift index 71d7d4076..4f50b7f36 100644 --- a/ElementX/Sources/Other/HTMLParsing/AttributedStringBuilderV2.swift +++ b/ElementX/Sources/Other/HTMLParsing/AttributedStringBuilderV2.swift @@ -164,6 +164,14 @@ struct AttributedStringBuilderV2: AttributedStringBuilderProtocol { content.setFontPreservingSymbolicTraits(UIFont.monospacedSystemFont(ofSize: UIFont.systemFontSize, weight: .regular)) content.addAttribute(.backgroundColor, value: UIColor.compound._bgCodeBlock as Any, range: NSRange(location: 0, length: content.length)) + // Don't allow identifiers in code blocks + content.removeAttribute(.MatrixRoomID, range: NSRange(location: 0, length: content.length)) + content.removeAttribute(.MatrixRoomAlias, range: NSRange(location: 0, length: content.length)) + content.removeAttribute(.MatrixUserID, range: NSRange(location: 0, length: content.length)) + content.removeAttribute(.MatrixEventOnRoomID, range: NSRange(location: 0, length: content.length)) + content.removeAttribute(.MatrixEventOnRoomAlias, range: NSRange(location: 0, length: content.length)) + content.removeAttribute(.MatrixAllUsersMention, range: NSRange(location: 0, length: content.length)) + case "hr": content = NSMutableAttributedString(string: "\n")