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

single column Markdown pipe table rendered by GFM and PHP fails under Pandoc #7919

Closed
vassudanagunta opened this issue Feb 13, 2022 · 9 comments
Labels

Comments

@vassudanagunta
Copy link

Explain the problem.

Pandoc fails to render the following markdown as a table:

single column table | 
------------------- | 
item 1              |
item 2              |

As can be seen directly below as well as in Babelmark 3, this is rendered as a table by GFM, PHP Markdown Extra, and many others.

single column table
item 1
item 2

Pandoc does render the following form as a table:

| single column table 
| ------------------- 
| item 1             
| item 2              

Pandoc version?
Pandoc 2.17.1, the current version on pandoc.org/try

@jgm
Copy link
Owner

jgm commented Feb 13, 2022

I see this in the code of the Markdown reader:

  -- surrounding pipes needed for a one-column table:
  guard $ not (length cells == 1 && not openPipe)

My guess is that this was put here for a reason! But what?

jgm added a commit that referenced this issue Feb 13, 2022
See #7919.

We still need to implement this for gfm (commonmark).
This must be done via changes in commonmark-hs.
@jgm jgm closed this as completed in dc534ca Feb 14, 2022
@mb21
Copy link
Collaborator

mb21 commented Feb 14, 2022

@vassudanagunta this should be fixed when using pandoc -f gfm in the next pandoc release...

@vassudanagunta
Copy link
Author

It wasn't affecting me directly but I thought you'd want to fix this. I only discovered it as I run the same input cases through Pandoc, GFM and my project to test compatibility.

@jgm @mb21 would a report of significant behavioral differences between Pandoc and GFM be useful to you?

@mb21
Copy link
Collaborator

mb21 commented Feb 14, 2022

The long-term plan is for what is currently commonmark_x to replace the current implementation of pandoc's markdown...

perhaps we should mention that in https://pandoc.org/MANUAL.html#markdown-variants ?

@jgm
Copy link
Owner

jgm commented Feb 15, 2022

@jgm @mb21 would a report of significant behavioral differences between Pandoc and GFM be useful to you?

Sure, but be sure you're comparing pandoc -f gfm behavior, not pandoc -f markdown which uses a different parser.

@vassudanagunta
Copy link
Author

OK, sounds like you're not interested in differences between -f markdown and GFM, but only those between -f gfm and GFM. Makes sense.

But what about commonmark_x? Is it essentially CommonMark + the same extensions used for -f markdown, making it a strict superset of CommonMark but not of GFM? Some of the GFM-overlapping extensions (e.g. pipe tables) behave differently from GFM, and in my opinion better than GFM, so I'm not suggesting being a superset of GFM is the best thing.

If there's no quick answer and this should be a discussion, I can move this to the Pandoc forum.

@jgm
Copy link
Owner

jgm commented Feb 15, 2022

commonmark_x is a superset of GFM in our implementation.
But it is NOT "the same extensions used for -f markdown"; it's a somewhat different set of extensions which includes many of those included by default in markdown, but not all of them, and also includes some different extensions like attributes.

@vassudanagunta
Copy link
Author

commonmark_x is a superset of GFM in our implementation.

I couldn't find that documented anywhere. I think that's important to make clear, both for user expectations as well as to gate bug reports, whether it is "contractually" a strict superset. I don't know if I should be filling bug reports for differences in pipe_table behavior, for example.

@jgm
Copy link
Owner

jgm commented Feb 15, 2022

Well, I spoke too soon. It's not quite a superset, because in gfm autolink_bare_uris is enabled, but commonmark_x doesn't turn this on by default. Both gfm and commonmark_x are defined as a set of extensions over commonmark; you can see which extensions are enabled by doing:

pandoc --list-extensions=gfm
pandoc --list-extensions=commonmark_x

(We prefer to make the information accessible in this form rather than updating the manual and potentially getting it out of sync with the code.)

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

No branches or pull requests

3 participants