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

Odd behaviour for multiple consecutive lists #142

Closed
ErisDS opened this issue Mar 16, 2015 · 7 comments
Closed

Odd behaviour for multiple consecutive lists #142

ErisDS opened this issue Mar 16, 2015 · 7 comments
Assignees
Labels

Comments

@ErisDS
Copy link
Contributor

ErisDS commented Mar 16, 2015

Showdown will convert a bulleted list, followed by an ordered list, into one big ordered list with paragraphs in certain items. I believe that this is not really what most people would expect the output to be.

According to Babelmark this behaviour comes from the original Markdown.pl library, however the majority of markdown libraries tested by Babelmark have changed the behaviour to output the two lists as a bulleted list followed by an ordered list.

You can also see in Babelmark that the same is true for the inverse - the majority of markdown libraries have changed away from the original behaviour.

I realise changing this would be backwards incompatible, but I believe it's unlikely many people rely on the existing behaviour - therefore I'd like to propose the behaviour be changed to match the behaviour that Babelmark shows:

That is

* Item 1
* Item 2

1. Item 1
2. Item 2

Converts to this in showdown currently:

<ul>
    <li>Item 1</li>
    <li>
        <p>Item 2</p>
    </li>
    <li>
        <p>Item 1</p>
    </li>
    <li>Item 2</li>
</ul>

I propose it ought to output:

<ul>
    <li>Item 1</li>
    <li>Item 2</li>
</ul>
<ol>
    <li>Item 1</li>
    <li>Item 2</li>
</ol>
@ErisDS ErisDS changed the title Odd behaviour for multiple consecutive lists (of different types) Odd behaviour for multiple consecutive lists Mar 16, 2015
@tivie
Copy link
Member

tivie commented Apr 22, 2015

Yeah, this is a known issue. We still haven't come to an agreement if we should stick to the original behaviour or not.

Personally I think this should be seen as a bug, as it doesn't really make sense. (same goes for adding paragraphs in lists)

@tivie tivie self-assigned this Apr 22, 2015
@tivie
Copy link
Member

tivie commented Apr 22, 2015

related to #41

@ErisDS
Copy link
Contributor Author

ErisDS commented Apr 22, 2015

I completely understand that making changes to markdown behaviour when the library is following the original implementation is a tricky decision. I don't suggest going against the original lightly :)

In this particular case, I think the current output is very clearly unexpected behaviour and therefore the original behaviour can be classified as incorrect / a bug. Also as I mentioned, I think the particularly odd nature of this means it's very very unlikely anyone is relying on this behaviour.

I'd also add that using babelmark to test snippets often comes up with quite a wide range of different implementations and in this particular case it's very clear that the majority of parsers have opted to classify the original behaviour as incorrect. Therefore I think it is pretty safe to follow suit, lest showdown become the only library still following the old way.

Nonetheless, I fully respect that this is not an easy decision to make. Some parsers have a normal version, and a 'strict' version for this sort of thing, but I do believe that's overkill in this particular case.

@pdeschen
Copy link
Contributor

@ErisDS I like your idea of strict mode. Or maybe quirks would be more appropriate. But then again, which of the rendering is the quirk one? 😄

@tivie
Copy link
Member

tivie commented May 28, 2015

So, I've tried to reach John Gruber by email to ask what it's opinion on this particular issue but he didn't answer (go figures =P). So I say we fix this in the next release.

@pdeschen @SyntaxRules what's your take on this?

@tivie
Copy link
Member

tivie commented Jun 13, 2015

@ErisDS The commit 0bdd02b partially fixes the issue.

Now

* item 1
* item 2

1. item 1
2. item 2

is parsed into

<ul>
    <li>Item 1</li>
    <li><p>Item 2</p></li>
</ul>
<ol>
    <li><p>Item 1</p></li>
    <li>Item 2</li>
</ol>

I couldn't pinpoint the origin of the issue with the extra paragraphs, I will have a look as soon as possible

tivie added a commit that referenced this issue Aug 1, 2015
Fix ghCodeBlocks not being correctly parsed inside lists. Also, as a side
effect, fixes issues with consecutive lists and extra paragraphs being
added into lists.

Closes #142, Closes #183, Closes #184
@tivie
Copy link
Member

tivie commented Aug 1, 2015

7720c88 now totally fixes this issue.

* item 1
* item 2

1. item 1
2. item 2

gets parsed into

<ul>
    <li>Item 1</li>
    <li>Item 2</li>
</ul>
<ol>
    <li>Item 1</li>
    <li>Item 2</li>
</ol>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants