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

Pandoc fails to escape initial % in markdown mode #3454

Closed
elliottslaughter opened this issue Feb 18, 2017 · 0 comments
Closed

Pandoc fails to escape initial % in markdown mode #3454

elliottslaughter opened this issue Feb 18, 2017 · 0 comments

Comments

@elliottslaughter
Copy link

elliottslaughter commented Feb 18, 2017

Here's the initial input:

$ perl -e 'print "\n% title\n% author\n% date\n"'

% title
% author
% date

Note that the initial blank line means that the % title line will not actually be treated as the title, but will be a paragraph containing a % character. (Similarly for author and date.)

Now let's run this through Pandoc and back:

$ perl -e 'print "\n% title\n% author\n% date\n"' | pandoc -s -f markdown -t json | pandoc -s -f json -t markdown
% title % author % date

Note that the initial blank line is gone. If we do another pass through Pandoc:

$ perl -e 'print "\n% title\n% author\n% date\n"' | pandoc -s -f markdown -t json | pandoc -s -f json -t markdown | pandoc -s -f markdown -t json | pandoc -s -f json -t markdown
---
title: 'title % author % date'
---

It now gets interpreted as a title.

The bug is in the first conversion from JSON to Markdown. When producing a Markdown file which contains an initial paragraph that starts with %, either the % should be escaped or there should be a blank line at the start to avoid interpreting the % as a title.

$ pandoc --version
pandoc 1.19.2.1
Compiled with pandoc-types 1.17.0.4, texmath 0.9, skylighting 0.1.1.5
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