Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Preserve inline HTML as text

Manav Rathie95fdd3bb6e1
diff --git a/apple/apps/ensu/Ensu/Chat/MessageList/MessageMarkdown.swift b/apple/apps/ensu/Ensu/Chat/MessageList/MessageMarkdown.swift
index e958f877a1..057da6183b 100644
--- a/apple/apps/ensu/Ensu/Chat/MessageList/MessageMarkdown.swift
+++ b/apple/apps/ensu/Ensu/Chat/MessageList/MessageMarkdown.swift
@@ -371,6 +371,10 @@ struct MarkdownParser {
return InlineContent(segments: [
.text(AttributedString(text.string, attributes: attributes))
])
+ case let html as InlineHTML:
+ return InlineContent(segments: [
+ .text(AttributedString(html.rawHTML, attributes: attributes))
+ ])
case is SoftBreak:
return InlineContent(segments: [.text(AttributedString(" ", attributes: attributes))])
case is LineBreak:
diff --git a/apple/apps/ensu/EnsuTests/MessageMarkdownTests.swift b/apple/apps/ensu/EnsuTests/MessageMarkdownTests.swift
index 077b67bb16..e9929e0db0 100644
--- a/apple/apps/ensu/EnsuTests/MessageMarkdownTests.swift
+++ b/apple/apps/ensu/EnsuTests/MessageMarkdownTests.swift
@@ -23,6 +23,8 @@ final class MessageMarkdownTests: XCTestCase {
("a $x$\n b $y$", ["x"], "a b $y$"),
("a $x$\\\nb $y$", ["x"], "a \nb $y$"),
("![0]() and $x$", ["x"], "0 and "),
+ ("<b>$x$</b> t", ["x"], "<b></b> t"),
+ ("Use <v> here.", [], "Use <v> here."),
]
for (source, math, text) in cases {
let inline = paragraph(source)