)+", with: " ", options: [.regularExpression, .caseInsensitive])
- // Remove HTML tags AND shortcodes in one pass
let range = NSRange(rawText.startIndex..., in: rawText)
let text = (regex?.stringByReplacingMatches(in: rawText, options: [], range: range, withTemplate: "") ?? rawText)
.stringByDecodingXMLCharacters()
diff --git a/Modules/Tests/WordPressSharedTests/GutenbergExcerptGeneratorTests.swift b/Modules/Tests/WordPressSharedTests/GutenbergExcerptGeneratorTests.swift
index eff9361a7686..fda1459ff824 100644
--- a/Modules/Tests/WordPressSharedTests/GutenbergExcerptGeneratorTests.swift
+++ b/Modules/Tests/WordPressSharedTests/GutenbergExcerptGeneratorTests.swift
@@ -31,4 +31,11 @@ struct GutenbergPostExcerptGeneratorTests {
let summary = GutenbergExcerptGenerator.firstParagraph(from: content, maxLength: 150)
#expect(summary == "Before")
}
+
+ @Test func testPostWithBRTags() {
+ let content = #"Yes,
look behind
in remembrance and with gratitude.
Then,
stay present,
or miss memories in the making.
"#
+
+ let summary = GutenbergExcerptGenerator.firstParagraph(from: content, maxLength: 150)
+ #expect(summary == "Yes, look behind in remembrance and with gratitude.")
+ }
}