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

Conversion from markdown to markdown_github alters escaped pipe characters #3887

Closed
cacology opened this issue Aug 31, 2017 · 3 comments
Closed

Comments

@cacology
Copy link
Contributor

Using pandoc 1.19.2.1 converting from pandoc flavored markdown to GitHub flavored markdown, an escaped pipe \| becomes a regular pipe |, which causes GitHub to make what should be a pipe character a table instead.

input file "example.md":

 This | is | a | pipe | table.
 
 This \| is \| a \| series \| of \| pipes.

command:

pandoc -f markdown -t markdown_github example.md

output:

This | is | a | pipe | table.

This | is | a | series | of | pipes.

expected output:

This | is | a | pipe | table.

This \| is \| a \| series \| of \| pipes.

My Haskell isn't great yet, but I think this might be an easy fix. If someone wants to try to point me at it, I'll try it, though I realize that may be more work than just fixing it...

Respectfully submitted,
-James

P.S. Probably not needed to fix the issue, but if you're curious as to why I need escaped pipes in my markdown, see: https://cacology.github.io/characters/ which uses pipes as the standard bibliographical notation to indicate line breaks. See also: http://www2.iath.virginia.edu/gants/Books/key.html or http://polaris.gseis.ucla.edu/jrichardson/dis237/Appendix%20A.htm

@jgm
Copy link
Owner

jgm commented Sep 4, 2017

We just need to escape all | characters when the pipe_tables extension is enabled.

@jgm
Copy link
Owner

jgm commented Sep 4, 2017

Look in src/Text/Pandoc/Writers/Markdown.hs, specifically at the escaping functions.

@jgm
Copy link
Owner

jgm commented Sep 4, 2017

I also noticed that the new gfm output format (in dev pandoc) doesn't escape pipes. This will require changes in the underlying C library.

@jgm jgm closed this as completed in 5fc4980 Sep 8, 2017
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

2 participants