List formatting breaks when there's an empty line separating them

I can’t get the raw text to display with </> formatting, so here (might need to open in new window or refresh to see source)

  • group A 1
  • group A 2
  • group A 3
  • group A 4
  • group A 5

When I try to have two lists separated by an empty line, it throws the whole thing out of whack:

  • group A 1

  • group A 2

  • group B 1

  • group B 2

  • group B 3

So far, workaround I found is to put empty paragraph in there

  • group A 1
  • group A 2

- group B 1 - group B 2 - group B 3

3 Likes

You generally cannot mix loose and tight spacing of lists in Markdown. Either the list is tight (no spaces) or loose (always spaces). Mixing the two within the same list will result in strangeness.

You should try in Babelmark to see what I mean

http://johnmacfarlane.net/babelmark2/

Or for more

So it seems common mark is the only one that I feel gets this correct

* List 1, Item 1
* List 1, Item 2
* List 1, Item 3
  
- List 2, Item 1
- List 2, Item 2
- List 2, Item 3

Common Mark/Cheapskates output:

Output in Discourse

  • List 1, Item 1
  • List 1, Item 2
  • List 1, Item 3
  • List 2, Item 1
  • List 2, Item 2
  • List 2, Item 3

I haven’t found a way to permit the following in any of the implementations yet:

* List 1, Item 1
* List 1, Item 2
* List 1, Item 3
  
* List 2, Item 1
* List 2, Item 2
* List 2, Item 3

Hacky, but inserting an HTML br tag seems to work

* List 1, Item 1  
* List 1, Item 2  
* List 1, Item 3  
<br>  
- List 2, Item 1
- List 2, Item 2
- List 2, Item 3
  • List 1, Item 1
  • List 1, Item 2
  • List 1, Item 3

  • List 2, Item 1
  • List 2, Item 2
  • List 2, Item 3

Except that you really only get a single <ul>:

1 Like

Thanks for catching that. I hadn’t looked at source.
I hadn’t had my coffee yet - that’s my excuse and I’m sticking with it.

This works better, but is far from being a perfect work-around. i.e. horizontal rule

* item A1
* item A2
* item A3
-----
- item B1
- item B2
- item B3
  • item A1
  • item A2
  • item A3

  • item B1
  • item B2
  • item B3

I’m not sure which one Discourse uses, but “pandoc” and a few others seem to get it right.

http://johnmacfarlane.net/babelmark2/?text=+-+waefwefawe +-+rtehergsergser +-+fawefawegaew +-+greagwergawe +-+egawegaewgew

This is totally resolved with markdown.it which we introduced a year or so ago

1 Like