Skip to content

Commit

Permalink
Fix parsing strikethrough
Browse files Browse the repository at this point in the history
  • Loading branch information
BarkingBad committed Sep 14, 2020
1 parent cd59d5d commit 139a020
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
4 changes: 2 additions & 2 deletions plugins/base/src/main/kotlin/parsers/MarkdownParser.kt
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,8 @@ class MarkdownParser(
defaultHandler(node)

private fun strikeThroughHandler(node: ASTNode) = DocTagsFromIElementFactory.getInstance(
GFMElementTypes.STRIKETHROUGH,
body = text.substring(node.startOffset, node.endOffset).transform()
node.type,
children = node.children.evaluateChildrenWithDroppedEnclosingTokens(2)
)

private fun tableHandler(node: ASTNode) = DocTagsFromIElementFactory.getInstance(
Expand Down
20 changes: 20 additions & 0 deletions plugins/base/src/test/kotlin/markdown/ParserTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -1307,5 +1307,25 @@ class ParserTest : KDocTest() {
)
executeTest(kdoc, expectedDocumentationNode)
}

@Test
fun `Text with Strikethrough`() {
val kdoc = """
| This is ~~strikethroughed~~
""".trimMargin()
val expectedDocumentationNode = DocumentationNode(
listOf(
Description(
P(
listOf(
Text("This is "),
Strikethrough(listOf(Text("strikethroughed")))
)
)
)
)
)
executeTest(kdoc, expectedDocumentationNode)
}
}

0 comments on commit 139a020

Please sign in to comment.