Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Issue on parsing Markdown with code span split between two lines #446

Merged
merged 1 commit into from
Dec 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ internal object RichTextStateMarkdownParser : RichTextStateParser<String> {
}

fun onText(text: String) {
val text = text.replace('\n', ' ')

if (text.isEmpty()) return

if (richParagraphList.isEmpty())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -447,4 +447,30 @@ class RichTextStateMarkdownParserEncodeTest {
)
}

@Test
fun testEncodeInlineCodeInDifferentLines() {
val markdown =
"""
Hello `World!
Kotlin` MP
""".trimIndent()

val state = RichTextStateMarkdownParser.encode(markdown)

val parsedString = state.toText()

assertEquals(
expected =
"""
Hello World! Kotlin MP
""".trimIndent(),
actual = parsedString,
)

assertEquals(
expected = 1,
actual = state.richParagraphList.size,
)
}

}
Loading