diff options
Diffstat (limited to 'plugins/base/src/main/kotlin')
-rw-r--r-- | plugins/base/src/main/kotlin/parsers/MarkdownParser.kt | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/plugins/base/src/main/kotlin/parsers/MarkdownParser.kt b/plugins/base/src/main/kotlin/parsers/MarkdownParser.kt index dfb95373..8422d3be 100644 --- a/plugins/base/src/main/kotlin/parsers/MarkdownParser.kt +++ b/plugins/base/src/main/kotlin/parsers/MarkdownParser.kt @@ -48,9 +48,18 @@ class MarkdownParser( private fun emphasisHandler(node: ASTNode): DocTag = DocTagsFromIElementFactory.getInstance( node.type, - children = listOf(visitNode(node.children[node.children.size / 2])) + children = node.children.evaluateChildrenWithDroppedEnclosingTokens(1) ) + private fun strongHandler(node: ASTNode): DocTag = + DocTagsFromIElementFactory.getInstance( + node.type, + children = node.children.evaluateChildrenWithDroppedEnclosingTokens(2) + ) + + private fun List<ASTNode>.evaluateChildrenWithDroppedEnclosingTokens(count: Int) = + drop(count).dropLast(count).evaluateChildren() + private fun blockquotesHandler(node: ASTNode): DocTag = DocTagsFromIElementFactory.getInstance( node.type, children = node.children @@ -256,7 +265,7 @@ class MarkdownParser( MarkdownElementTypes.ATX_5, MarkdownElementTypes.ATX_6 -> headersHandler(node) MarkdownTokenTypes.HORIZONTAL_RULE -> horizontalRulesHandler(node) - MarkdownElementTypes.STRONG, + MarkdownElementTypes.STRONG -> strongHandler(node) MarkdownElementTypes.EMPH -> emphasisHandler(node) MarkdownElementTypes.FULL_REFERENCE_LINK, MarkdownElementTypes.SHORT_REFERENCE_LINK -> referenceLinksHandler(node) |