# Should single element lists be supported?

**URL:** <https://talk.commonmark.org/t/should-single-element-lists-be-supported/1957>\
**Category:** Spec\
**Created:** [January 3, 2016, 12:35pm UTC](https://talk.commonmark.org/t/should-single-element-lists-be-supported/1957 "2016-01-03T12:35:00Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![chrisalley](https://talk.commonmark.org/user_avatar/talk.commonmark.org/chrisalley/32/906_2.png) [@chrisalley](https://talk.commonmark.org/u/chrisalley)\
**Post date:** [January 3, 2016, 12:35pm UTC](https://talk.commonmark.org/t/should-single-element-lists-be-supported/1957/1 "2016-01-03T12:35:00Z")

</div>

`1986. What a great season.`

This produces an ordered list with one list item. To avoid creating a list, you must type `1986\. What a great season.`

Markua has a nice alternative. In Markua, [single element ordered lists are not lists](https://leanpub.com/markua/read#leanpub-auto-in-markua-a-single-element-ordered-list-is-not-a-list). So `1986. What a great season`. on it’s own becomes a paragraph.

> To me, the notion of a list is something with more than one thing in it. If I have a list of chores to do, there are many of them. If I have one chore to do, I don’t call it a list of chores–I call it a chore.

> So, in Markua, the automatic creation of an ordered list only happens if you have two or more lines starting with numbers and periods.

Should CommonMark adopt this rule? Are there any use cases for single element lists (ordered or unordered)?

---

<div class="post-metadata">

**Author:** ![tin-pot](https://talk.commonmark.org/user_avatar/talk.commonmark.org/tin-pot/32/810_2.png) [@tin-pot](https://talk.commonmark.org/u/tin-pot)\
**Post date:** [January 3, 2016, 1:30pm UTC](https://talk.commonmark.org/t/should-single-element-lists-be-supported/1957/2 "2016-01-03T13:30:00Z")

</div>

I happen to write, or rather: misuse, single-item “lists” from time to time, mostly as a means to highlight the item content. But I’m not sure how valuable this possibility should be considered.

On the other hand—and this is not really a form of misuse, but more like an edge case—there might be cases where “conceptionally” several items belong to the same list, while “technically” they are separated by other, non-item stuff, like paragraphs or images or even headings.

In this case, it would be useful to have

- single-item “lists” to host the dispersed list items, and also
- to continue numbering the items in an ordered list “across” the intervening stuff.

Is it not the case that the problem you point out occurs primarily because a line starting with “`1986.⎵What a great season.`” would _interrupt_ the current paragraph? At least I see no real problem in the case when above and below this line are blank lines in the input text.

So maybe it would be sufficient to “forbid” single-item lists only from occurring _inside a paragraph_, ie without being separated by blank lines?

---

<div class="post-metadata">

**Author:** ![Crissov](https://talk.commonmark.org/user_avatar/talk.commonmark.org/crissov/32/1455_2.png) [@Crissov](https://talk.commonmark.org/u/Crissov)\
**Post date:** [January 3, 2016, 1:41pm UTC](https://talk.commonmark.org/t/should-single-element-lists-be-supported/1957/3 "2016-01-03T13:41:43Z")

</div>

I’ve seen continuous lists being interrupted by (often explanatory) paragraphs that were not part of list items. This may happen with single items, of course. Contrived example:

```auto
Fruits I like the best:
1. Apples
2. Oranges

… but cannot digest properly:
3. Bananas

```

So, yes, a single-item list would not have to be supported, but it can’t be distinguished reliably from a solitary item of an interrupted list.

---

<div class="post-metadata">

**Author:** ![tin-pot](https://talk.commonmark.org/user_avatar/talk.commonmark.org/tin-pot/32/810_2.png) [@tin-pot](https://talk.commonmark.org/u/tin-pot)\
**Post date:** [January 3, 2016, 3:15pm UTC](https://talk.commonmark.org/t/should-single-element-lists-be-supported/1957/4 "2016-01-03T15:15:24Z")

</div>

> but it can’t be distinguished reliably from a solitary item of an interrupted list.

There’s no need for such a distinction, as “interrupted list” is a “meta-term” – from the point of _CommonMark_, there are only (nested) lists, any “interruption” simply terminates the list. However, a reader may “see” an interrupted list, and see “conceptionally” as a whole (list) what technically are multiple lists.

In a (technically, not “conceptionally”!) single-item list the distinction between “compact” and “loose” style is moot anyway, as far as I can see—right?

So the “Bananas” solitary item in your example (which is in fact what I had in mind!) could be equally well written as:

```
… but cannot digest properly:

3. Bananas

```

I would say that according to the current spec, a processor _must_ produce the _same_ result for both “Bananas”. So the “Bananas” item can be separated by a blank line, and the rule “no single-item list in a paragraph” would not impede the use of single-item lists in general (for notating “conceptionally” single lists which were “accidentally” interrupted).

Technically, both “Bananas” items constitute each an independent, single-item list. “Conceptionally” (ie, for the author and/or the reader, well: hopefully “and” …), conceptionally the “Bananas” item is the third item in an “interrupted” list, starting with “Apples” and “Oranges”.

---

<div class="post-metadata">

**Author:** ![chrisalley](https://talk.commonmark.org/user_avatar/talk.commonmark.org/chrisalley/32/906_2.png) [@chrisalley](https://talk.commonmark.org/u/chrisalley)\
**Post date:** [January 4, 2016, 10:36am UTC](https://talk.commonmark.org/t/should-single-element-lists-be-supported/1957/5 "2016-01-04T10:36:53Z")

</div>

> [@tin-pot](#):
>
> So maybe it would be sufficient to “forbid” single-item lists only from occurring inside a paragraph, ie without being separated by blank lines?

I’m not sure what you mean by “inside a paragraph” - can you explain how the `1986. What a great season.` example differs from the `3. Bananas` example? Or give another example of where the “no single-item list in a paragraph” rule would apply.

---

<div class="post-metadata">

**Author:** ![tin-pot](https://talk.commonmark.org/user_avatar/talk.commonmark.org/tin-pot/32/810_2.png) [@tin-pot](https://talk.commonmark.org/u/tin-pot)\
**Post date:** [January 4, 2016, 12:06pm UTC](https://talk.commonmark.org/t/should-single-element-lists-be-supported/1957/6 "2016-01-04T12:06:12Z")

</div>

The “no single-item list inside a paragraph” rule would apply—and would exclude the recognition of a list item—_both_ in the original example (concerning the “`1986.⎵`” at the line’s beginning):

```
Oh, I still remember
1986.⎵What a great season.

```

or here:

```
Oh, I still remember
1986.⎵What a great season.
We don't have those today anymore.

```

And _also_ in the “Banana” example:

```
… but cannot digest properly:
3.⎵Bananas    

```

Here “`3.⎵`” would not be accepted as a list item marker, because there is only _one_ (candidate) item in the block, too: just as in the “`1986.⎵`” examples.

* * *

But this rule does no harm, because for example the “Bananas” input text can written in this—I think completely equivalent—way:

```
… but cannot digest properly:

3.⎵Bananas    

```

if one wants to create a single-item list containing the numbered “Bananas” item.

And the same holds for the two “`1986.⎵`” examples, if one _would_ insist on creating a single-item list using this as the item number: This input would produce a single-item list:

```
Oh, I still remember

1986.⎵What a great season.

```

As would this:

```
Oh, I still remember

1986.⎵What a great season.

We don't have those today anymore.

```

* * *

[**Edit:**] Note that said rule does **not** apply to a “candidate” for a list item marker in the _first_ line of a block (that is, when the _block itself_ starts with an item marker). So this:

```
Oh, I still remember:

1986.⎵What a great season.
We don't have those today anymore.

```

would **still** produce a single-item list, just as it does according to the current _CommonMark_ rules (whether one likes it or not).

---

<div class="post-metadata">

**Author:** ![chrisalley](https://talk.commonmark.org/user_avatar/talk.commonmark.org/chrisalley/32/906_2.png) [@chrisalley](https://talk.commonmark.org/u/chrisalley)\
**Post date:** [January 4, 2016, 12:41pm UTC](https://talk.commonmark.org/t/should-single-element-lists-be-supported/1957/7 "2016-01-04T12:41:49Z")

</div>

Thanks for the clarification. The proposal you’re suggesting is to allow single element lists in some cases, but not others. That’s moving in the direction of a rule that’s non-uniform, something which CommonMark [strives against](http://spec.commonmark.org/0.23/#principle-of-uniformity), so perhaps it is better to leave out the “no single-item list inside a paragraph” exception even though it would be useful in some cases.

Regarding the other replies to this topic, some strong arguments have been raised for continuing to support single element lists.

---

<div class="post-metadata">

**Author:** ![tin-pot](https://talk.commonmark.org/user_avatar/talk.commonmark.org/tin-pot/32/810_2.png) [@tin-pot](https://talk.commonmark.org/u/tin-pot)\
**Post date:** [January 4, 2016, 4:42pm UTC](https://talk.commonmark.org/t/should-single-element-lists-be-supported/1957/8 "2016-01-04T16:42:57Z")

</div>

> [@chrisalley](#):
>
> Thanks for the clarification. The proposal you’re suggesting is to allow single element lists in some cases, but not others.

No, that’s not what I wrote. Let me clarify my view further (you might want to skip this, and jump to my **“actual list syntax-rule change”** proposal below …):

**If** the rules should be changed with the intent to _cursory_ (and IMO: **arbitrarily** , ie without good reason nor gain) preclude single-item lists in _CommonMark_, then **at least** make sure that this _will_ produce a (yes: one-item long) list:

```
Lorem ipsum dolor sit amet, consectetur adipiscing elit.

1.⎵Donec a diam lectus.

Sed sit amet ipsum mauris. 

```

Because the following **will** still produce a list, right? (Or I’ll let go all hopes for the syntax …)

```
Lorem ipsum dolor sit amet, consectetur adipiscing elit.

1.⎵Donec a diam lectus.
2.⎵Donec sed odio eros.

Sed sit amet ipsum mauris. 

```

If you disagree—and suggest that the first input would better **not** create a list, but the second input **should** —then I’d ask you: how is that **not** moving in the direction of a rule that’s non-uniform, and a rule that would enforce this would not only be “non-uniform”, but also lack any good reason, and fails to accomplish any advantage, as far as I can see from the discussion so far.

* * *

So if you ask me what I’d propose: I see only two reasonable decisions here:

1. _Leave the syntax rules as they are now:_ They are not “perfect”, but I see no pressing need to change them. A free-standing line (preceded and followed by a _blank line_) starting with “`1986.⎵`” _would_ still produce a list item, but considering that such a situation is (a) quite easy to visually recognize and to fix while writing, and (b) impossible to arise “inadvertently” through re-formatting a paragraph’s text—why the impetus to _rule out any and all list with only one item_ as a “remedy”?

2. _Change the syntax rules to avoid “unwanted” list items:_ The motivation behind your “`1986.⎵What a great season.” example seems to be that this might produce a _list item_ where none is intended—otherwise, this whole discussion would be for naught. But “avoiding unwanted list items” has little to do with the **number** of items in a list, and precluding single-item lists is IMO arguably the wrong approach to do it, see below.

* * *

Consider an input text where your line appears inside a paragraph like this:

```
Oh, I still remember
1986.⎵What a great season.
We don't have those today anymore. Or wait 'till
3.⎵October.

```

Simply declaring single-item lists “verboten” won’t help in this case: as I understand it, this would still produce (as it will now, and as `cmark` does output):

1. An ordinary paragraph with _character content_ “`Oh, I still remember`”;

2. A two-item long, ordered list where

Assuming that creating a list like that was not the intention here, observe that:

1. Even if single-item lists are forbidden, this paragraph would still generate a (two-item!) list;

2. If you’d replace the FULL STOP following “`3`” in the last line by say a COMMA, then—assuming single-item lists were forbidden—the paragraph would suddenly **not** produce a list any more: how’s that for a _subtle change_ in the input text with _non-local_ consequences?

3. The “`3.⎵`” in the last line **could** plausibly have ended up there as a result of re-formatting the input text paragraph (as I have tried to show by making it grammatically part of a sentence).

4. To check whether this (or any other) block of lines will be treated by a _CommonMark_ processor as a “plain” paragraph, or will be split into _list items_, one must _inspect each and every line start in it_: this is so according to the _current_ syntax rules, and it would still be the case according to rules where “single-item” lists were “forbidden” (excluded, suppressed, not accepted, …).

* * *

## An actual list syntax-rule change proposal

All in all I’d agree that the current rules make the “inadvertent creation” of list items too easy, and too hard to avoid, in particular in cases where the input text has undergone some automatic line-breaking process (be it a text formatter, be it a text generator).

But instead of precluding single-item lists it would seem more sensible and useful to drop the rule that “list item lines” (ie lines starting with “`3.⎵`” or “-⎵” etc) can _interrupt_ a paragraph _even if that paragraph so far was nothing else but an ordinary piece of text_, ie a “plain” paragraph which did _not_ start with a list item (marker).

Dropping this rule seems even more sensible when taking into account that the rule _is not needed anyway_, namely: it achieves nothing what couldn’t be achieved without it (as the “`Bananas.`” examples above should make clear), simply by inserting a _blank line_ before the _intended_ first item line of a list to create.

Does this make sense?

---

<div class="post-metadata">

**Author:** ![tin-pot](https://talk.commonmark.org/user_avatar/talk.commonmark.org/tin-pot/32/810_2.png) [@tin-pot](https://talk.commonmark.org/u/tin-pot)\
**Post date:** [January 4, 2016, 6:02pm UTC](https://talk.commonmark.org/t/should-single-element-lists-be-supported/1957/9 "2016-01-04T18:02:01Z")

</div>

> [@chrisalley](#):
>
> […] something which CommonMark strives against, […]

The pertaining quote from the _CommonMark_ spec is, as I suppose that’s what you meant with “uniformity” (bold highlighting done by me):

> Our adherence to the principle of uniformity thus inclines us to think that there are two coherent packages:
> 
> - Require blank lines **before all lists** and blockquotes, **including lists that occur as sublists inside other list items**.
> 
> - Require blank lines **in none of these places**.
> 
> _reStructuredText_ takes the first approach, for which there is much to be said. But the second seems more consistent with established practice with _Markdown_.

To be honest: I don’t buy into the assertion that there are _only two_ “coherent packages”—I’ll take that to mean “design decisions”—, but since there are no other “packages” discussed, that seems to be the implication here.

In fact I believe that there is (at least!) one more “consistent package”, and that accepting this simple dichotomy between “everywhere” or “nowhere” (to require a _blank line_, in our case) as the primary guideline for syntax design does more harm than good.

The “third package” (regarding lists) I’d like to propose would be simply:

- Require a blank line **before the first line of a list**.

* * *

That is, here a blank line would (newly) be reqired:

```
Aurea prima sata est aetas qua vindice nullo

1. Sponte sua, sine lege, fidem rectumque colebat.

```

But (as before) not here:

```
 1. Sponte sua, 
    - sine lege,
    - fidem rectumque colebat.

```

The main effect (and purpose) of restricting the recognition of “list items”, or more precise: _lines that start a new list_, in this way is to avoid creating “accidental” items inside a “plain” paragraph. I think this would be worthwhile, and I see no drawback incurred by introducing this rule.

---

<div class="post-metadata">

**Author:** ![jgm](https://talk.commonmark.org/user_avatar/talk.commonmark.org/jgm/32/1360_2.png) [@jgm](https://talk.commonmark.org/u/jgm)\
**Post date:** [January 5, 2016, 10:47pm UTC](https://talk.commonmark.org/t/should-single-element-lists-be-supported/1957/10 "2016-01-05T22:47:10Z")

</div>

This “third package” does violate the principle of uniformity, since if you take this text:

```auto
Sponte sua,
- sine lege

```

and put it in a list item, it would have a different meaning than it does on its own. If you don’t care about the principle of uniformity, then yes, there are many packages, but my claim was about packages that respect the principle.

---

<div class="post-metadata">

**Author:** ![tin-pot](https://talk.commonmark.org/user_avatar/talk.commonmark.org/tin-pot/32/810_2.png) [@tin-pot](https://talk.commonmark.org/u/tin-pot)\
**Post date:** [January 5, 2016, 11:00pm UTC](https://talk.commonmark.org/t/should-single-element-lists-be-supported/1957/11 "2016-01-05T23:00:05Z")

</div>

You mean that

```
Sponte sua,
- sine lege

```

would _not_ be a list, but a vanilla paragraph, while “putting it in a list item” like this:

```
- Sponte sua
    - sine lege

```

_would_ produce a “different meaning”, in that the second line would be seen as a subordinate list item?

Well, yes, that’s certainly true. But I would reckon that “determining the (and that may be: a different!) meaning” of a piece of text is _precisely what mark-up is supposed to do_. I mean, if you take said paragraph and insert four SPACEs in front of each line, wouldn’t that produce a “different meaning”, too? And notably, whether or not the paragraph would be seen as a list before or not: it certainly isn’t afterwards.

The same holds true, for example, switching between _ATX heading_ and _setext heading_ syntax: there too, and with much weaker rationale, you can’t just “transplant” a piece of text from one context into the other without side effects on meaning.

Or do you mean something quite different than that with “principle of uniformity”?

---

<div class="post-metadata">

**Author:** ![jgm](https://talk.commonmark.org/user_avatar/talk.commonmark.org/jgm/32/1360_2.png) [@jgm](https://talk.commonmark.org/u/jgm)\
**Post date:** [January 5, 2016, 11:57pm UTC](https://talk.commonmark.org/t/should-single-element-lists-be-supported/1957/12 "2016-01-05T23:57:41Z")

</div>

I mean this: [CommonMark Spec](http://spec.commonmark.org/0.23/#principle-of-uniformity)

---

<div class="post-metadata">

**Author:** ![tin-pot](https://talk.commonmark.org/user_avatar/talk.commonmark.org/tin-pot/32/810_2.png) [@tin-pot](https://talk.commonmark.org/u/tin-pot)\
**Post date:** [January 6, 2016, 12:10am UTC](https://talk.commonmark.org/t/should-single-element-lists-be-supported/1957/13 "2016-01-06T00:10:16Z")

</div>

Well, okay. That’s a principle.

Do you agree that an **implication** of this principle is that in:

```
Sponte sua,
- sine lege

```

and in:

```
Lorem ipsum dolor sit amet, consectetur adipiscing elit. 
Donec a diam lectus. 2. Sed sit amet ipsum mauris. 
Maecenas congue ligula ac quam viverra nec consectetur.
3. ante hendrerit. Donec et mollis dolor. 4. Praesent et diam 
eget libero egestas mattis sit amet vitae augue. 5. Nam tincidunt 
congue enim, ut porta lorem lacinia consectetur. 
Donec ut libero sed arcu vehicula ultricies a non tortor. 
6. Lorem ipsum dolor sit amet, consectetur adipiscing elit. 

```

and so on, an author now

- **must** inspect each and every line, and

- **must** edit each and every line-start which “looks like” a list item marker (that is here: the “`-␣`”, the “`3.␣`” and “`6.␣`”, but not the “`2.␣`” and “`4.␣`” etc)

- into say “`3\.␣`” and “`6\.␣`”, and

- **must** do this for **every** decimal numeral after SPACE followed by FULL STOP, and

- for **every** HYPEN-MINUS between SPACES, and

- for **every** such ASTERISK and PLUS SIGN too,

in order to ensure that his _paragraph_ will be interpreted as a vanilla _paragraph_? And is this not _more effort_, and _more special cases_, than to have the simple rule “a new list can only _start_ after a blank line”? [**Nota bene:** had the second example _started_ with “`1.␣`” at the beginning of its first line, the situation would be very different: in that case, the decision that this **is** (meant to be) a list, or at least a list item, would be done and dealt with right in the first line.]

Because that’s how I see the the uniformity at play here.

---

<div class="post-metadata">

**Author:** ![jgm](https://talk.commonmark.org/user_avatar/talk.commonmark.org/jgm/32/1360_2.png) [@jgm](https://talk.commonmark.org/u/jgm)\
**Post date:** [January 6, 2016, 5:12am UTC](https://talk.commonmark.org/t/should-single-element-lists-be-supported/1957/14 "2016-01-06T05:12:49Z")

</div>

It’s a matter of balances. Each of the proposals has advantages and disadvantages. If I were designing for myself, I’d take the reStructuredText package, requiring blank lines everywhere. I don’t think that’s really an option, though, since it would break too many existing Markdown documents. Another option is to give up the principle of uniformity, as you suggest. But then a completely new spec for block quotes and list items would need to be drawn up, since the current one assumes that the principle holds. The principle is also, I think, a good principle; uniformity makes the syntax easier to remember. The drawback is, just as you say, an increased risk of accidentally triggering lists. One has to weigh the pros and cons (and believe me, I’ve done that).

Note that even if one gives up the principle of uniformity to reduce risk of accidental lists at the outer level, that wouldn’t do anything to reduce the same kind of risk in list items themselves:

```auto
* Lorem ipsum dolor sit amet, consectetur adipiscing elit. 
  Donec a diam lectus. 2. Sed sit amet ipsum mauris. 
  Maecenas congue ligula ac quam viverra nec consectetur.
  3. ante hendrerit. Donec et mollis dolor. 4. Praesent et diam 
  eget libero egestas mattis sit amet vitae augue. 5. Nam tincidunt 
  congue enim, ut porta lorem lacinia consectetur. 
  Donec ut libero sed arcu vehicula ultricies a non tortor. 
  6. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

```

So, authors are going to need to look out for this kind of thing in any case.

---

<div class="post-metadata">

**Author:** ![tin-pot](https://talk.commonmark.org/user_avatar/talk.commonmark.org/tin-pot/32/810_2.png) [@tin-pot](https://talk.commonmark.org/u/tin-pot)\
**Post date:** [January 6, 2016, 7:05am UTC](https://talk.commonmark.org/t/should-single-element-lists-be-supported/1957/15 "2016-01-06T07:05:30Z")

</div>

> [@jgm](#):
>
> Note that even if one gives up the principle of uniformity to reduce risk of accidental lists at the outer level, that wouldn’t do anything to reduce the same kind of risk in list items themselves:

Yes, that was the gist of my “nota bene” remark; at least in this case a look at the _first_ line of the block would give a hint whether it falls into the “list” or “vanilla paragraph” camp.

Apart from that, I agree that at the core of this matter is, as you state:

> The principle is also, I think, a good principle; uniformity makes the syntax easier to remember. The drawback is, just as you say, an increased risk of accidentally triggering lists. One has to weigh the pros and cons (and believe me, I’ve done that).

I happen to weigh said risk a bit heavier than formally sticking to a principle—but that’s indeed a matter of preferences.

Given the disparity in current implementation’s behavior, any _Markdown_ writer should watch out for that risk anyway, and probably for a long time coming.

An even nastier case is documented in your _BabelMark_ [FAQ](http://johnmacfarlane.net/babelmark2/faq.html) as _[List items and code spans](http://johnmacfarlane.net/babelmark2/?normalize=1&text=-+%60a+long+code+span+can+contain+a+hyphen+characater+like+this%0A++-+and+it+can+screw+things+up%60%0A%0A%0A%0A)_:

```
- `a long code span can contain a hyphen characater like this
  - and it can screw things up`

```

In light of the various implementation’s results, including the _CommonMark_ implementation, the phrase “can screw things up” seems more than appropriate: there’s not _one_ implementation that keeps the _code span_ intact; but then again there seems to be no remedy as long as the basic parsing model, “blocks first, then inline content”, applies. And _here_ I do agree that this should probably stay as it is.

[So in a sense, disrupting the _code span_ is correct by definition; and the only guideline for writers would be “just don’t do that!”]
