diff options
author | Vadim Mishenev <vad-mishenev@yandex.ru> | 2022-08-30 16:17:54 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-30 16:17:54 +0300 |
commit | c9f1d60af8776c14d35ed11f512c3c7b0dfad3a2 (patch) | |
tree | b1013542fddd5a3e036161d55da9728ef07e841a /plugins/base/src/main/kotlin/parsers/factories | |
parent | a4bccbf8920a2f6f5fcf5bdf1f201d1129a05b62 (diff) | |
download | dokka-c9f1d60af8776c14d35ed11f512c3c7b0dfad3a2.tar.gz dokka-c9f1d60af8776c14d35ed11f512c3c7b0dfad3a2.tar.bz2 dokka-c9f1d60af8776c14d35ed11f512c3c7b0dfad3a2.zip |
Fix missing space between Markdown elements (#2640)
Diffstat (limited to 'plugins/base/src/main/kotlin/parsers/factories')
-rw-r--r-- | plugins/base/src/main/kotlin/parsers/factories/DocTagsFromIElementFactory.kt | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/plugins/base/src/main/kotlin/parsers/factories/DocTagsFromIElementFactory.kt b/plugins/base/src/main/kotlin/parsers/factories/DocTagsFromIElementFactory.kt index ea87dce8..fed3f7eb 100644 --- a/plugins/base/src/main/kotlin/parsers/factories/DocTagsFromIElementFactory.kt +++ b/plugins/base/src/main/kotlin/parsers/factories/DocTagsFromIElementFactory.kt @@ -9,7 +9,6 @@ import org.intellij.markdown.flavours.gfm.GFMTokenTypes import org.jetbrains.dokka.base.translators.parseWithNormalisedSpaces import org.jetbrains.dokka.links.DRI import org.jetbrains.dokka.model.doc.DocTag.Companion.contentTypeParam -import java.lang.NullPointerException object DocTagsFromIElementFactory { @@ -40,7 +39,12 @@ object DocTagsFromIElementFactory { body.orEmpty(), children, params - ) else body?.parseWithNormalisedSpaces(renderWhiteCharactersAsSpaces = false).orEmpty() + ) else { + // corner case: there are only spaces between two Markdown nodes + val containsOnlySpaces = body?.isNotEmpty() == true && body.all { it.isWhitespace() } + if (containsOnlySpaces) Text(" ", children, params) + else body?.parseWithNormalisedSpaces(renderWhiteCharactersAsSpaces = false).orEmpty() + } MarkdownTokenTypes.HORIZONTAL_RULE -> HorizontalRule MarkdownTokenTypes.HARD_LINE_BREAK -> Br GFMElementTypes.STRIKETHROUGH -> Strikethrough(children, params) |