Issue #3484 resolved

Markdown parsing bug when handling parragraph inside lists

Pablo Castellazzi
created an issue

{{{ - description first paragraph second paragraph }}}

should transform to

{{{ <ul> <li> <p>description</p> <p>first paragraph</p> <p>second paragraph</p> </li> </ul> }}}

instead is converted to:

{{{ <ul><li>description</li></ul> <p>first paragraph</p> <p>second paragraph</p> }}}

Check the README.md on https://bitbucket.org/fombitars/rails_bootstrap for a more complete example.

Comments (3)

  1. David Chambers

    I'm confused by your example.

    >>> import markdown
    >>> markdown.version
    '2.1.0'
    >>> markdown.markdown('''- *description*
    ...   first paragraph
    ...   second paragraph''')
    u'<ul>\n<li><em>description</em>\n  first paragraph\n  second paragraph</li>\n</ul>'
    

    Looking at your README didn't make things any clearer. Which markup do you wish to generate?

  2. Pablo Castellazzi reporter

    Sorry about that. I will try to be more clear.

    Python's markdown parser is ignoring indentation, it's treating the paragraphs as independant entities instead of nested entities as it should be. Attached is a sample file (test.md) with the output generated by python's markdown parser (output.real.txt) and the expected output (output.expected.txt) .

    The expected output was verified using:

  3. David Chambers

    Thanks for the clarification. The following snippet, which appears in the Markdown syntax “specification”, explains why your input is not generating the desired output.

    List items may consist of multiple paragraphs. Each subsequent paragraph
    in a list item must be indented by either 4 spaces or one tab:
    
    1.  This is a list item with two paragraphs. Lorem ipsum dolor
        sit amet, consectetuer adipiscing elit. Aliquam hendrerit
        mi posuere lectus.
    
        Vestibulum enim wisi, viverra nec, fringilla in, laoreet
        vitae, risus. Donec sit amet nisl. Aliquam semper ipsum
        sit amet velit.
    
    2.  Suspendisse id sem consectetuer libero luctus adipiscing.
    
  4. Log in to comment