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

List handling not consistent with Markdown.pl #442

Closed
gandalf3 opened this issue Nov 10, 2015 · 1 comment
Closed

List handling not consistent with Markdown.pl #442

gandalf3 opened this issue Nov 10, 2015 · 1 comment

Comments

@gandalf3
Copy link

Given this input markdown

Some text

* **Example**

 This should be part of the list element

* **Other example**

 But it's not in to python-markdown :/

* **list element**

 Instead it's a separate list!

End text

I expect it to render like this:

Some text

  • Example

    This should be part of the list element

  • Other example

    But it's not in to python-markdown :/

  • list element

    Instead it's a separate list!

End text

But python-markdown gives this to me:

<p>Some text</p>
<ul>
<li><strong>Example</strong></li>
</ul>
<p>This should be part of the list element</p>
<ul>
<li><strong>Other example</strong></li>
</ul>
<p>But it's not in to python-markdown :/</p>
<ul>
<li><strong>list element</strong></li>
</ul>
<p>Instead it's a separate list!</p>
<p>End text</p>

Every list element is put in its own list!


Markdown.pl from https://daringfireball.net/projects/markdown/ behaves as expected:

<p>Some text</p>

<ul>
<li><p><strong>Example</strong></p>

<p>This should be part of the list element</p></li>
<li><p><strong>Other example</strong></p>

<p>But it's not in to python-markdown :/</p></li>
<li><p><strong>list element</strong></p>

<p>Instead it's a separate list!</p></li>
</ul>

<p>End text</p>
@mitya57
Copy link
Collaborator

mitya57 commented Nov 10, 2015

You need to use four spaces for indentation. The “Indentation/Tab Length” section in the documentation explains why it is so and how to change it.

Let me quote it here:

The syntax rules clearly state that when a list item consists of multiple paragraphs, “each subsequent paragraph in a list item must be indented by either 4 spaces or one tab” (emphasis added). However, many implementations do not enforce this rule and allow less than 4 spaces of indentation. The implementers of Python-Markdown consider it a bug to not enforce this rule.

This applies to any block level elements nested in a list, including paragraphs, sub-lists, blockquotes, code blocks, etc. They must always be indented by at least four spaces (or one tab) for each level of nesting.

In the event that one would prefer different behavior, tab_length can be set to whatever length is desired. Be warned however, as this will affect indentation for all aspects of the syntax (including root level code blocks).

@mitya57 mitya57 closed this as completed Nov 10, 2015
This was referenced Nov 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants