markdown-rs
markdown-rs copied to clipboard
Markdown in beginning of a row in a Table with no outer pipes
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: ...,
}
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! :)