summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-03-24 16:18:39 +0100
committerLinnea Gräf <nea@nea.moe>2024-03-24 16:18:53 +0100
commit306515545281007d1df8733e3aa2bee974e29123 (patch)
treed55df49fe4fbee4d4f207051ed9696665d089fce
parent340fc50af3a33f5d3f2fc1928d6ce34baae0bd4e (diff)
downloadblog-infra-306515545281007d1df8733e3aa2bee974e29123.tar.gz
blog-infra-306515545281007d1df8733e3aa2bee974e29123.tar.bz2
blog-infra-306515545281007d1df8733e3aa2bee974e29123.zip
Fix standalone double star
-rw-r--r--src/main/kotlin/moe/nea/blog/md/ItalicsParser.kt3
-rw-r--r--src/test/kotlin/moe/nea/blog/md/test/TestItalics.kt5
2 files changed, 6 insertions, 2 deletions
diff --git a/src/main/kotlin/moe/nea/blog/md/ItalicsParser.kt b/src/main/kotlin/moe/nea/blog/md/ItalicsParser.kt
index 9f60200..6fce529 100644
--- a/src/main/kotlin/moe/nea/blog/md/ItalicsParser.kt
+++ b/src/main/kotlin/moe/nea/blog/md/ItalicsParser.kt
@@ -2,7 +2,7 @@ package moe.nea.blog.md
object ItalicsParser : InlineParser {
override fun detect(lookback: MarkdownFormat, rest: String): Boolean {
- return (lookback is Whitespace || lookback is Begin) && "\\*+[^ ].*".toRegex().matches(rest)
+ return (lookback is Whitespace || lookback is Begin) && "\\*+[^* ].*".toRegex().matches(rest)
}
override val specialSyntax: Set<Char>
@@ -70,5 +70,4 @@ object ItalicsParser : InlineParser {
combined = Bold(combined)
return Pair(combined, remainingText)
}
-
} \ No newline at end of file
diff --git a/src/test/kotlin/moe/nea/blog/md/test/TestItalics.kt b/src/test/kotlin/moe/nea/blog/md/test/TestItalics.kt
index 0e08473..5cd8cb4 100644
--- a/src/test/kotlin/moe/nea/blog/md/test/TestItalics.kt
+++ b/src/test/kotlin/moe/nea/blog/md/test/TestItalics.kt
@@ -46,6 +46,11 @@ class TestItalics {
}
@Test
+ fun testStandaloneDoubleStar() {
+ assertInlineFormat("** hi*", "** hi*")
+ }
+
+ @Test
fun testStandaloneItalics() {
assertInlineFormat("<i>italic</i>", "*italic*")
}