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

Inconsistent List-Parsing with code blocks #173

Closed
apfelbox opened this issue May 15, 2014 · 6 comments
Closed

Inconsistent List-Parsing with code blocks #173

apfelbox opened this issue May 15, 2014 · 6 comments

Comments

@apfelbox
Copy link
Contributor

Hi,

I noticed some incosistent list parsing Sometimes it creates a paragraph inside the <li></li> sometimes it doesn't. Seem to depend on the extra line:

Without

* List
* List
* List with code
  ´´´
  this works!
  ´´´
* Test

Generates

<ul>
<li>List</li>
<li>List</li>
<li>List with code
<pre><code>this works!</code></pre></li>
<li>Test</li>
</ul>

With Paragraph (notice the empty line)

* List
* List
* List with code
  ´´´
  this works!
  ´´´

* Test

Generates

<ul>
<li>List</li>
<li>List</li>
<li>
<p>List with code</p>
<pre><code>this works!</code></pre>
</li>
<li>Test</li>
</ul>

(I used ´ for the fenced code blocks in the examples because I can't get the github parse to not parse them in the examples)

@cebe
Copy link
Contributor

cebe commented May 15, 2014

This is expected and part of the markdown specs. http://daringfireball.net/projects/markdown/syntax#list

@hkdobrev
Copy link
Contributor

@apfelbox You've described the Markdown spec really, really close to the original 😄:

If list items are separated by blank lines, Markdown will wrap the items in

tags in the HTML output. For example, this input:

*   Bird
*   Magic

will turn into:

<ul>
<li>Bird</li>
<li>Magic</li>
</ul>

But this:

*   Bird

*   Magic

will turn into:

<ul>
<li><p>Bird</p></li>
<li><p>Magic</p></li>
</ul>

@apfelbox
Copy link
Contributor Author

Ah, sorry! (Ok, the spec seems weird here, but since it's in the spec, it's ok. 😄)

Nevertheless:
The spec is unclear about which elements should be wrapped though, I read that both list items around the blank line should be wrapped.

This is not the case for the last <li> in my example.

@hkdobrev
Copy link
Contributor

👍

This is the first example on http://parsedown.org/consistency

And I think Parsedown is not acting correctly.

@33mhz
Copy link

33mhz commented Jun 30, 2016

This still appears to be an issue. Or maybe #176. It correctly wraps the contents of the last <li> with <p>, but not the first <li> in the list.

GitHub will turn



* one 
* two


* one
* two
* three
* four


* one


* one


into

<ul>
 <li>one</li>
 <li><p>two</p></li>
 <li><p>one</p></li>
 <li>two</li>
 <li>three</li>
 <li><p>four</p></li>
 <li><p>one</p></li>
 <li><p>one</p></li>
</ul>

Parsedown turns it into:

<ul>
 <li>one</li>
 <li><p>two</p></li>
 <li>one</li>
 <li>two</li>
 <li>three</li>
 <li><p>four</p></li>
 <li><p>one</p></li>
 <li>one</li>
</ul>

@aidantwoods
Copy link
Collaborator

I believe inconsistent addition of paragraphs should have been solved in #475, which was included in Parsedown 1.7.1 so I'm going to close this for now, but let me know if there is an issue still present :)

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

6 participants