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

Markdown in beginning of a row in a Table with no outer pipes #81

Open
FauconFan opened this issue Sep 18, 2023 · 1 comment
Open

Markdown in beginning of a row in a Table with no outer pipes #81

FauconFan opened this issue Sep 18, 2023 · 1 comment

Comments

@FauconFan
Copy link

Hi,

Thank you for this rust-native markdown parser. It is really helpful in one of my project!
Just wanted to report a bug (I believe it is a bug) when, in a table, there is markdown styling at the beginning of a row of a table without outer pipes. Here is an example:

Markdown:

Markdown | Less | Pretty
--- | --- | ---
*Still* | `renders` | **nicely**
1 | 2 | 3

GitHub:

Markdown Less Pretty
Still renders nicely
1 2 3

GitHub renders it nicely, but markdown-rs renders one table with the rest being a paragraph text between starting from the inner markdown. (I believe this is a bug, because stackedit, dillinger and markdownpreview are rendering this nicely too)

I am using the to_mdast function and I have the following mdast structure: (positions omitted for clarity).
I am using the latest version 1.0.0-alpha.13

Root {
    children: [
        Table {
            children: [
                TableRow {
                    children: [
                        TableCell {
                            children: [
                                Text {
                                    value: "Markdown",
                                    position: ...
                                },
                            ],
                            position: ...,
                        },
                        TableCell {
                            children: [
                                Text {
                                    value: "Less",
                                    position: ...,
                                },
                            ],
                            position: ...,
                        },
                        TableCell {
                            children: [
                                Text {
                                    value: "Pretty",
                                    position: ...,
                                },
                            ],
                            position: ...,
                        },
                    ],
                    position: ...,
                },
            ],
            position: ...,
            align: [
                None,
                None,
                None,
            ],
        },
        Paragraph {
            children: [
                Emphasis {
                    children: [
                        Text {
                            value: "Still",
                            position: ...,
                        },
                    ],
                    position: ...,
                },
                Text {
                    value: " | ",
                    position: ...,
                },
                InlineCode {
                    value: "renders",
                    position: ...,
                },
                Text {
                    value: " | ",
                    position: ...,
                },
                Strong {
                    children: [
                        Text {
                            value: "nicely",
                            position: ...,
                        },
                    ],
                    position: ...,
                },
                Text {
                    value: "\n1 | 2 | 3",
                    position: ...,
                },
            ],
            position: ...,
        },
    ],
    position: ...,
}
@FauconFan FauconFan changed the title Markdown in Table Markdown in beginning of a row in a Table with no outer pipes Sep 18, 2023
@wooorm
Copy link
Owner

wooorm commented Sep 20, 2023

Heya! Thanks for your kind words :)

That does sound like a bug. I recommend trying to make your test case as small as possible. Remove everything that isn’t needed to repro. AFAIK I do have tests for similar things. https://github.com/wooorm/markdown-rs/blob/main/tests/gfm_table.rs. Thanks! :)

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

No branches or pull requests

2 participants