Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KDoc parser: Missing space between consecutive composite leaf nodes in markdown parser #1975

Closed
msink opened this issue Jun 21, 2021 · 2 comments · Fixed by #2640
Closed
Labels
Milestone

Comments

@msink
Copy link
Contributor

msink commented Jun 21, 2021

Describe the bug
/** Rotates paths by `amount` **radians** around (`x`, `y`). */
rendered
Rotates paths by `amount`**radians** around (`x`, `y`).

Expected behaviour
Rotates paths by `amount` **radians** around (`x`, `y`).

To Reproduce
Actual bug is in KDoc parser, to reproduce - add test below in ParserTest.kt
Actually passes with Text(" ") commented-out, while should with uncommented.

    @Test
    fun `Code and bold`() {
        val kdoc = "Rotates paths by `amount` **radians** around (`x`, `y`)."
        val expectedDocumentationNode = DocumentationNode(
            listOf(
                Description(
                    CustomDocTag(
                        listOf(
                            P(
                                listOf(
                                    Text("Rotates paths by "),
                                    CodeInline(listOf(Text("amount"))),
                                    //Text(" "),
                                    B(listOf(Text("radians"))),
                                    Text(" around ("),
                                    CodeInline(listOf(Text("x"))),
                                    Text(", "),
                                    CodeInline(listOf(Text("y"))),
                                    Text(")."),
                                )
                            )
                        ), name = MarkdownElementTypes.MARKDOWN_FILE.name
                    )
                )
            )
        )
        executeTest(kdoc, expectedDocumentationNode)
    }

    @Test
    fun `Code with backticks`() {
        val kdoc = "` `` ` ` ``` `"
        val expectedDocumentationNode = DocumentationNode(
            listOf(
                Description(
                    CustomDocTag(
                        listOf(
                            P(
                                listOf(
                                    CodeInline(listOf(Text("`` "))),
                                    //Text(" "),
                                    CodeInline(listOf(Text("``` "))),
                                )
                            )
                        ), name = MarkdownElementTypes.MARKDOWN_FILE.name
                    )
                )
            )
        )
        executeTest(kdoc, expectedDocumentationNode)
    }

Traced - space is removed in

private fun List<ASTNode>.mergeLeafASTNodes(): List<ASTNode> {

On entry it is here, on exit - dropped.

Why?

@IgnatBeresnev
Copy link
Member

There's also some more investigation done by me in #2446 (comment)

@IgnatBeresnev IgnatBeresnev added this to the Backlog milestone Apr 26, 2022
@IgnatBeresnev IgnatBeresnev changed the title KDoc parser: Missed space after CodeInline KDoc parser: Missing space between consecutive composite leaf nodes in markdown parser Aug 12, 2022
@vmishenev vmishenev linked a pull request Aug 24, 2022 that will close this issue
@vmishenev
Copy link
Member

The fix will be in Dokka 1.7.20.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants