summaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea/blog/md/MarkdownParser.kt
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-05-03 00:02:29 +0200
committerLinnea Gräf <nea@nea.moe>2024-05-03 00:02:29 +0200
commit1b563a0378998f2fed28bf81b8e254cb47742503 (patch)
tree0ab727813c2150b8293ebcd3d16bfe5ea4e25562 /src/main/kotlin/moe/nea/blog/md/MarkdownParser.kt
parent7e24b934bbd424669a1c935894dd8799d4db0348 (diff)
downloadblog-infra-master.tar.gz
blog-infra-master.tar.bz2
blog-infra-master.zip
Improve paragraph detectionHEADmaster
Diffstat (limited to 'src/main/kotlin/moe/nea/blog/md/MarkdownParser.kt')
-rw-r--r--src/main/kotlin/moe/nea/blog/md/MarkdownParser.kt10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/main/kotlin/moe/nea/blog/md/MarkdownParser.kt b/src/main/kotlin/moe/nea/blog/md/MarkdownParser.kt
index 673a0ed..4705d4b 100644
--- a/src/main/kotlin/moe/nea/blog/md/MarkdownParser.kt
+++ b/src/main/kotlin/moe/nea/blog/md/MarkdownParser.kt
@@ -21,7 +21,15 @@ class MarkdownParser(source: String) {
}
fun readChildBlock(): MarkdownBlock? {
- val peek = peekLine() ?: return null
+ var peek = ""
+ while (true) {
+ peek = peekLine() ?: return null
+ if (peek.isBlank()) {
+ consumeLine()
+ } else {
+ break
+ }
+ }
val blockParser = findParserFor(peek) ?: ParagraphParser
return blockParser.parse(this)
}