diff --git a/Sources/Ink/Internal/FormattedText.swift b/Sources/Ink/Internal/FormattedText.swift index 74fd67b..ed244d1 100644 --- a/Sources/Ink/Internal/FormattedText.swift +++ b/Sources/Ink/Internal/FormattedText.swift @@ -115,7 +115,7 @@ private extension FormattedText { continue } - guard !nextCharacter.isAny(of: ["\n", "#", "<", "`", "-"]) else { + guard !nextCharacter.isAny(of: ["\n", "#", "<", "`", "-", "\r\n"]) else { break } diff --git a/Tests/InkTests/TextFormattingTests.swift b/Tests/InkTests/TextFormattingTests.swift index 2acb8b6..3900e52 100644 --- a/Tests/InkTests/TextFormattingTests.swift +++ b/Tests/InkTests/TextFormattingTests.swift @@ -13,6 +13,16 @@ final class TextFormattingTests: XCTestCase { XCTAssertEqual(html, "

Hello, world!

") } + func testParagraphs() { + let html = MarkdownParser().html(from: "Hello, world!\n\nAgain.") + XCTAssertEqual(html, "

Hello, world!

Again.

") + } + + func testDosParagraphs() { + let html = MarkdownParser().html(from: "Hello, world!\r\n\r\nAgain.") + XCTAssertEqual(html, "

Hello, world!

Again.

") + } + func testItalicText() { let html = MarkdownParser().html(from: "Hello, *world*!") XCTAssertEqual(html, "

Hello, world!

") @@ -167,6 +177,8 @@ extension TextFormattingTests { static var allTests: Linux.TestList { return [ ("testParagraph", testParagraph), + ("testParagraphs", testParagraphs), + ("testDosParagraphs", testDosParagraphs), ("testItalicText", testItalicText), ("testBoldText", testBoldText), ("testItalicBoldText", testItalicBoldText),