From a95ebf82d2f91858079f65daf71f6a89e9e383ae Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sat, 27 Dec 2014 20:15:21 -0800 Subject: spec: Added rule for empty list item. Closes #242. --- spec.txt | 90 ++++++++++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 62 insertions(+), 28 deletions(-) diff --git a/spec.txt b/spec.txt index 5fd36f2..3e96e6f 100644 --- a/spec.txt +++ b/spec.txt @@ -2920,9 +2920,65 @@ the above case: . +3. **Empty list item.** A [list marker](#list-marker) followed by a +line containing only [whitespace](#whitespace) is a list item with +no contents. -3. **Indentation.** If a sequence of lines *Ls* constitutes a list item - according to rule #1 or #2, then the result of indenting each line +Here is an empty bullet list item: + +. +- foo +- +- bar +. + +. + +It does not matter whether there are spaces following the +[list marker](#list-marker): + +. +- foo +- +- bar +. + +. + +Here is an empty ordered list item: + +. +1. foo +2. +3. bar +. +
    +
  1. foo
  2. +
  3. +
  4. bar
  5. +
+. + +A list may start or end with an empty list item: + +. +* +. + +. + +4. **Indentation.** If a sequence of lines *Ls* constitutes a list item + according to rule #1, #2, or #3, then the result of indenting each line of *L* by 1-3 spaces (the same for each line) also constitutes a list item with the same contents and attributes. If a line is empty, then it need not be indented. @@ -3016,7 +3072,7 @@ Four spaces indent gives a code block: . -4. **Laziness.** If a string of lines *Ls* constitute a [list +5. **Laziness.** If a string of lines *Ls* constitute a [list item](#list-item) with contents *Bs*, then the result of deleting some or all of the indentation from one or more lines in which the next [non-space character](#non-space-character) after the indentation is @@ -3096,8 +3152,8 @@ continued here.

. -5. **That's all.** Nothing that is not counted as a list item by rules - #1--4 counts as a [list item](#list-item). +6. **That's all.** Nothing that is not counted as a list item by rules + #1--5 counts as a [list item](#list-item). The rules for sublists follow from the general rules above. A sublist must be indented the same number of spaces a paragraph would need to be @@ -3196,28 +3252,6 @@ A list may be the first block in a list item: . -A list item may be empty: - -. -- foo -- -- bar -. - -. - -. -- -. - -. - A list item can contain a header: . @@ -3296,7 +3330,7 @@ determine the indentation necessary for blocks to fall under the list item, rather than having a fixed and arbitrary number. The writer can think of the body of the list item as a unit which gets indented to the right enough to fit the list marker (and any indentation on the list -marker). (The laziness rule, #4, then allows continuation lines to be +marker). (The laziness rule, #5, then allows continuation lines to be unindented if needed.) This rule is superior, we claim, to any rule requiring a fixed level of -- cgit v1.2.3