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

Table rendering in parsedown #379

Closed
AjubaNet opened this issue Jan 19, 2016 · 5 comments
Closed

Table rendering in parsedown #379

AjubaNet opened this issue Jan 19, 2016 · 5 comments

Comments

@AjubaNet
Copy link

Following table render nicely in PHP MarkdownExtra that I use from Michael F.. However, with Parsedown, this produces table that is missing empty cells. While this behavior can be justified in tbody row 1, it cannot be justifed in row 3 and row 4, where table cell(s) shifted to the left, hence losing column alignment. Please consider addressing this.

a|b|c
-|-|-
d|e| 
f|g|h
|a|c
|a|

Above markdown code is also expected to work the same, even with extra leading pipes.
Ideally, I would like a completely balanced table, with all rows have same number of columns.

@aidantwoods
Copy link
Collaborator

I think that Parsedown maybe shouldn't be missing the cells, but the column alignment seems to match what GitHub gives:

GitHub
screen shot 2018-02-28 at 17 14 27
Parsedown
screen shot 2018-02-28 at 17 15 30

@aidantwoods
Copy link
Collaborator

Closing since the result matches spec

@AjubaNet
Copy link
Author

AjubaNet commented Apr 2, 2018

In the last two rows, leading '|' should've rendered first cell as blank.

IMHO, Consideration comes from the reference, which is header row.

If header row has leading pipe character, all rows are expected to have leading pipe. However, rows without leading pipe are rendered assuming '|' in the beginning.

On the contrary, if header row does NOT have leading pipe character, any rows that have leading pipe character should render first cell as blank.

@aidantwoods
Copy link
Collaborator

The reason that the leading pipe is before first row is because the spec says that leading and trailing pipes are optional (but doesn't distinguish cases where some rows have this and others do not).

[...] A leading and trailing pipe is also recommended for clarity of reading, and if there’s otherwise parsing ambiguity.

https://github.github.com/gfm/#tables-extension-

You could try opening an issue over at https://github.com/github/cmark/issues to discuss a spec change. GitHub will also be able to get some metrics on whether changes would break too many existing texts (for example if we include a leading pipe in the header, and then require one in subsequent rows this would cause a subset of valid tables to no longer render).

@AjubaNet
Copy link
Author

AjubaNet commented Apr 2, 2018 via email

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

No branches or pull requests

3 participants