# List line spacing is crazy

**URL:** <https://talk.commonmark.org/t/list-line-spacing-is-crazy/2114>\
**Category:** Spec\
**Created:** [May 31, 2016, 3:42am UTC](https://talk.commonmark.org/t/list-line-spacing-is-crazy/2114 "2016-05-31T03:42:09Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![techtonik](https://cdn.commonmark.org/user_avatar/talk.commonmark.org/techtonik/32/981_2.png) [@techtonik](https://talk.commonmark.org/u/techtonik)\
**Post date:** [May 31, 2016, 3:42am UTC](https://talk.commonmark.org/t/list-line-spacing-is-crazy/2114/1 "2016-05-31T03:42:09Z")

</div>

List line spacing is crazy. When there is an empty line separator to split unordered list in two, Commonmark for some reason adds spacing between more items. Look at the bottom of those two links. First is without empty lines between some (not all) list items. Second is with them.

[https://chromium.googlesource.com/angle%2Fangle/+/e31fd8753bb62c6d951efb9be463f7671d342b15](https://chromium.googlesource.com/angle%2Fangle/+/e31fd8753bb62c6d951efb9be463f7671d342b15)

```
* 1
* 2
* 3`

```

- 1
- 2
- 3

[https://chromium.googlesource.com/angle%2Fangle/+/2b7313e8fa6d969002f3a20feeb288bbe92dbc35](https://chromium.googlesource.com/angle%2Fangle/+/2b7313e8fa6d969002f3a20feeb288bbe92dbc35)

```
* 1
* 2
* 3

* 4

```

- 1

- 2

- 3

- 4

---

<div class="post-metadata">

**Author:** ![zzzzBov](https://cdn.commonmark.org/user_avatar/talk.commonmark.org/zzzzbov/32/218_2.png) [@zzzzBov](https://talk.commonmark.org/u/zzzzBov)\
**Post date:** [May 31, 2016, 4:16am UTC](https://talk.commonmark.org/t/list-line-spacing-is-crazy/2114/2 "2016-05-31T04:16:31Z")

</div>

This appears to be a bug in Discourse, rather than in CommonMark.

[The dingus doesn’t appear to present this issue](http://spec.commonmark.org/dingus/?text=*%201%0A*%202%0A*%203%0A%0A*%204) when a [loose](http://spec.commonmark.org/0.25/#loose) list is used.

---

<div class="post-metadata">

**Author:** ![techtonik](https://cdn.commonmark.org/user_avatar/talk.commonmark.org/techtonik/32/981_2.png) [@techtonik](https://talk.commonmark.org/u/techtonik)\
**Post date:** [May 31, 2016, 12:00pm UTC](https://talk.commonmark.org/t/list-line-spacing-is-crazy/2114/3 "2016-05-31T12:00:15Z")

</div>

The issue is still there. Is it what you call a “loose list”? Why it is a feature?

[http://spec.commonmark.org/dingus/?text=](http://spec.commonmark.org/dingus/?text=)_%201%0A_%202%0A\*%203%0A%0A\*%204

[http://spec.commonmark.org/dingus/?text=](http://spec.commonmark.org/dingus/?text=)_%201%0A_%202%0A\*%203%0A\*%204

---

<div class="post-metadata">

**Author:** ![zzzzBov](https://cdn.commonmark.org/user_avatar/talk.commonmark.org/zzzzbov/32/218_2.png) [@zzzzBov](https://talk.commonmark.org/u/zzzzBov)\
**Post date:** [May 31, 2016, 1:27pm UTC](https://talk.commonmark.org/t/list-line-spacing-is-crazy/2114/4 "2016-05-31T13:27:21Z")

</div>

> [@techtonik](#):
>
> Is it what you call a “loose list”?

[it’s not my term, and I’ve already linked to the part of the spec that defines this behavior](http://spec.commonmark.org/0.25/#loose), but I’ll add it here anyway:

> A list is loose if any of its constituent list items are separated by blank lines, or if any of its constituent list items directly contain two block-level elements with a blank line between them. Otherwise a list is tight. (The difference in HTML output is that paragraphs in a loose list are wrapped in `<p>` tags, while paragraphs in a tight list are not.)

The spec then goes on to define the _exact_ behavior that the dingus produces.

As for your second question:

> [@techtonik](#):
>
> Why it is a feature?

I don’t know, I didn’t write the spec, and I only gave this section a cursory glance to point you in the right direction. I would recommend that you invest some of your own time to read it, and _then_ ask questions for further clarification.

---

<div class="post-metadata">

**Author:** ![jgm](https://cdn.commonmark.org/user_avatar/talk.commonmark.org/jgm/32/1360_2.png) [@jgm](https://talk.commonmark.org/u/jgm)\
**Post date:** [May 31, 2016, 7:54pm UTC](https://talk.commonmark.org/t/list-line-spacing-is-crazy/2114/5 "2016-05-31T19:54:37Z")

</div>

This isn’t a CommonMark quirk. All Markdown implementations I know of create a single list with this input:  
[http://johnmacfarlane.net/babelmark2/?normalize=1&text=](http://johnmacfarlane.net/babelmark2/?normalize=1&text=)_+1%0A_+2%0A\*+3%0A%0A\*+4%0A

Currently in CommonMark you can separate two lists with two blank lines (though we may remove that feature). In all Markdown implementations you can use a blank HTML comment to separate two lists.

An alternative spec would disallow a mix of tight and loose list spacing. So, if a list starts out “tight,” then when a blank line is encountered, the list ends and you have a new list. I think I even considered this and we discussed it in the early days, but I don’t recall all of the considerations.

Feel free to discuss this here. The spec isn’t set in stone yet.

---

<div class="post-metadata">

**Author:** ![techtonik](https://cdn.commonmark.org/user_avatar/talk.commonmark.org/techtonik/32/981_2.png) [@techtonik](https://talk.commonmark.org/u/techtonik)\
**Post date:** [June 2, 2016, 5:28am UTC](https://talk.commonmark.org/t/list-line-spacing-is-crazy/2114/6 "2016-06-02T05:28:46Z")

</div>

My biggest complain appears to be about `<p>` insertion, not about single list. Most of the implementations get this almost right for me:

[http://johnmacfarlane.net/babelmark2/?normalize=1&text=](http://johnmacfarlane.net/babelmark2/?normalize=1&text=)_+1%0A_+2%0A\*+3%0A%0A\*+4%0A

```auto
<ul>
    <li>1</li>
    <li>2</li>
    <li>
        <p>3</p>
    </li>
    <li>
        <p>4</p>
    </li>
</ul>

```

But commonmark inserts `<p>` for every element if at least one of the items needs a block. That is the thing I hated about reStructuredText. You have a nice CSS for `ul li` rule, but everything is ruined when one list item needs more text or code block inserted - then all other list items lose formatting. And this “scope violation” is a bug or misfeature for me.

---

<div class="post-metadata">

**Author:** ![jgm](https://cdn.commonmark.org/user_avatar/talk.commonmark.org/jgm/32/1360_2.png) [@jgm](https://talk.commonmark.org/u/jgm)\
**Post date:** [June 2, 2016, 6:27pm UTC](https://talk.commonmark.org/t/list-line-spacing-is-crazy/2114/7 "2016-06-02T18:27:34Z")

</div>

Mixed tight and loose lists are typographically bad.

Note also that CommonMark is not HTML-centric. We want to support output in LaTeX, for example. In LaTeX there isn’t a clean way to get a mixed tight/loose list. You adjust inter-item spacing for the whole list.

---

<div class="post-metadata">

**Author:** ![techtonik](https://cdn.commonmark.org/user_avatar/talk.commonmark.org/techtonik/32/981_2.png) [@techtonik](https://talk.commonmark.org/u/techtonik)\
**Post date:** [June 3, 2016, 7:17am UTC](https://talk.commonmark.org/t/list-line-spacing-is-crazy/2114/8 "2016-06-03T07:17:02Z")

</div>

> [@jgm](#):
>
> Mixed tight and loose lists are typographically bad.

I am not mixing them. Need tight lists only, always, with occasional code sections, pictures etc. If I need different styling, I would use stylesheets, but it is impossible to style output markup when this markup is not consistent.

---

<div class="post-metadata">

**Author:** ![jgm](https://cdn.commonmark.org/user_avatar/talk.commonmark.org/jgm/32/1360_2.png) [@jgm](https://talk.commonmark.org/u/jgm)\
**Post date:** [June 3, 2016, 5:41pm UTC](https://talk.commonmark.org/t/list-line-spacing-is-crazy/2114/9 "2016-06-03T17:41:36Z")

</div>

Why don’t you give an example of a realistic case that you don’t think CommonMark handles well? It is possible, currently, to have tight lists that contain code blocks, pictures, etc.

---

<div class="post-metadata">

**Author:** ![techtonik](https://cdn.commonmark.org/user_avatar/talk.commonmark.org/techtonik/32/981_2.png) [@techtonik](https://talk.commonmark.org/u/techtonik)\
**Post date:** [June 4, 2016, 6:41pm UTC](https://talk.commonmark.org/t/list-line-spacing-is-crazy/2114/10 "2016-06-04T18:41:02Z")

</div>

Output: [https://chromium.googlesource.com/angle/angle/+/ae0c126a7a599182e36f2b1b2ebcfc8b78e3b471#Contributing](https://chromium.googlesource.com/angle/angle/+/ae0c126a7a599182e36f2b1b2ebcfc8b78e3b471#Contributing)

Source: [https://chromium.googlesource.com/angle/angle/+show/ae0c126a7a599182e36f2b1b2ebcfc8b78e3b471/README.md](https://chromium.googlesource.com/angle/angle/+show/ae0c126a7a599182e36f2b1b2ebcfc8b78e3b471/README.md)

---

<div class="post-metadata">

**Author:** ![jgm](https://cdn.commonmark.org/user_avatar/talk.commonmark.org/jgm/32/1360_2.png) [@jgm](https://talk.commonmark.org/u/jgm)\
**Post date:** [June 5, 2016, 3:54am UTC](https://talk.commonmark.org/t/list-line-spacing-is-crazy/2114/11 "2016-06-05T03:54:20Z")

</div>

What do you want the output to look like in the last example? It seems to me that what you want is three separate unordered lists, all “tight.” I don’t think it makes much typographic sense to have a single list in which some items are tight and some loose.

Three consecutive tight lists can be achieved, with current CommonMark, by putting two blank lines (rather than one) between the lists.
