generated from rnentjes/kotlin-server-web-empty
Extend list parsing to handle multi-line items, improve checkbox list parsing with edge case handling, add unordered/ordered list tests, and update version to 1.0.6.
This commit is contained in:
@@ -8,7 +8,7 @@ plugins {
|
||||
}
|
||||
|
||||
group = "nl.astraeus"
|
||||
version = "1.0.6"
|
||||
version = "1.0.7"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
|
||||
@@ -182,6 +182,9 @@ fun markdown(text: String): List<MarkdownPart> {
|
||||
}
|
||||
|
||||
if (type == MarkdownType.CHECKBOX_LIST) {
|
||||
if (buffer.isNotBlank()) {
|
||||
addCheckbox(checkboxList, index, buffer)
|
||||
}
|
||||
parts.add(MarkdownPart.CheckboxList(checkboxList))
|
||||
} else {
|
||||
parseBuffer()
|
||||
|
||||
@@ -105,6 +105,22 @@ class ParseTest {
|
||||
printMarkdownParts(md)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testCheckboxList2() {
|
||||
val input = """
|
||||
# Todo
|
||||
|
||||
- [ ] Handle multi line lists correctly;
|
||||
as long as there is no empty line the text is appended to last item in the list
|
||||
- [x] Autolinks, text between < > will be parsed as a generic link. It's up
|
||||
to the using application what to do with it.""".trimIndent()
|
||||
|
||||
val md = markdown(input)
|
||||
|
||||
printMarkdownParts(md)
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
fun testCheckboxListError() {
|
||||
val input = """
|
||||
|
||||
Reference in New Issue
Block a user