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

Markdown parsing confusion with code block after list #3733

Closed
pri22296 opened this issue Jun 11, 2017 · 3 comments
Closed

Markdown parsing confusion with code block after list #3733

pri22296 opened this issue Jun 11, 2017 · 3 comments

Comments

@pri22296
Copy link

converting the following as markdown_github to html

- Item1
- Item2
```yaml
section:
  - Code Line1
  - Code Line2
```

gives

<ul>
<li>Item1</li>
<li>Item2<br />
```yaml<br />
section:</li>
<li>Code Line1</li>
<li>Code Line2<br />
```</li>
</ul>

while github renders it correctly.
screenshot 140

It seems pandoc's markdown_github reader is not able to parse the code block correctly due to presence of - inside the codeblock. If - is removed inside the code block, it is converted correctly.

Pandoc version : 1.19.2

@jgm
Copy link
Owner

jgm commented Jun 11, 2017

Here's a smaller case (it has nothing to do with markdown_github specifically, so this just uses default pandoc markdown):

% pandoc
- a
```
- b
```
^D
<ul>
<li>a ```</li>
<li>b ```</li>
</ul>

Pandoc's method for identifying the raw text of a list item is apparently not sensitive to fenced code, when there is no blank line before the fence.

@jgm
Copy link
Owner

jgm commented Jun 11, 2017

Note that pandoc's manual says:

Like regular code blocks, fenced code blocks must be separated
from surrounding text by blank lines.

However, pandoc's markdown doesn't obey this consistently:

% pandoc
a
```
b
```
^D
<p>a</p>
<pre><code>b</code></pre>

And of course, github allows the fences without blank space.

Note: GitHub is now using commonmark, so you could try pandoc -f commonmark. This gives you basic commonmark without the GitHub extensions (e.g. tables), but it might work better in your case.

@jgm
Copy link
Owner

jgm commented Jun 11, 2017

See #3509 for the best way forward for accurate parsing of markdown_github. However, as the above shows, there are issues here too for pandoc's markdown.

@jgm jgm changed the title Incorrect parsing of markdown_github Markdown parsing confusion with code block after list Aug 18, 2017
@jgm jgm added this to the pandoc 2.0 milestone Aug 18, 2017
@jgm jgm closed this as completed in 5ab1162 Aug 19, 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

3 participants