diff --git a/simpleast-core/build.gradle b/simpleast-core/build.gradle index b9c069f..1da3157 100644 --- a/simpleast-core/build.gradle +++ b/simpleast-core/build.gradle @@ -8,7 +8,7 @@ android { minSdkVersion 21 targetSdkVersion 30 versionCode 28 - versionName "2.1.2" + versionName "2.1.3" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" diff --git a/simpleast-core/src/main/java/com/discord/simpleast/code/CodeRules.kt b/simpleast-core/src/main/java/com/discord/simpleast/code/CodeRules.kt index 4b24e36..a017f70 100644 --- a/simpleast-core/src/main/java/com/discord/simpleast/code/CodeRules.kt +++ b/simpleast-core/src/main/java/com/discord/simpleast/code/CodeRules.kt @@ -25,7 +25,7 @@ object CodeRules { * Examples: * inlined ```test``` * inlined ```kt language code blocks need newline``` - * inlined block start ```kt + * inlined block start ``` * fun test() * ``` * @@ -38,7 +38,7 @@ object CodeRules { * ``` */ val PATTERN_CODE_BLOCK: Pattern = - Pattern.compile("""^```(?:([\w+\-.]+?)(\s*\n))?([^\n].*?)\n*```""", Pattern.DOTALL) + Pattern.compile("""^```(?:([\w+\-.]+?)?(\s*\n))?([^\n].*?)\n*```""", Pattern.DOTALL) val PATTERN_CODE_INLINE: Pattern = Pattern.compile("""^`(?:\s*)([^\n].*?)\n*`""", Pattern.DOTALL) diff --git a/simpleast-core/src/test/java/com/discord/simpleast/code/CodeRulesTest.kt b/simpleast-core/src/test/java/com/discord/simpleast/code/CodeRulesTest.kt index ce95ddf..165a231 100644 --- a/simpleast-core/src/test/java/com/discord/simpleast/code/CodeRulesTest.kt +++ b/simpleast-core/src/test/java/com/discord/simpleast/code/CodeRulesTest.kt @@ -43,6 +43,17 @@ class CodeRulesTest { ast.assertNodeContents>("code", "spaces ", "some text") } + @Test + fun noLanguageBlocked() { + val ast = parser.parse(""" + Sample: ``` + **block text** + ``` + """.trimIndent(), TestState()) + + ast.assertNodeContents>("**block text**") + } + @Test fun commentsRust() { val ast = parser.parse("""