cmark

My personal build of CMark ✏️

Commit
a95ebf82d2f91858079f65daf71f6a89e9e383ae
Parent
8a3e53a75c9b9da0ad36c2048a6264263b97eac0
Author
John MacFarlane <jgm@berkeley.edu>
Date

spec: Added rule for empty list item.

Closes #242.

Diffstat

1 file changed, 62 insertions, 28 deletions

Status File Name N° Changes Insertions Deletions
Modified spec.txt 90 62 28
diff --git a/spec.txt b/spec.txt
@@ -2920,9 +2920,65 @@ the above case:
 </ul>
 .
 
+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
+.
+<ul>
+<li>foo</li>
+<li></li>
+<li>bar</li>
+</ul>
+.
+
+It does not matter whether there are spaces following the
+[list marker](#list-marker):
+
+.
+- foo
+-   
+- bar
+.
+<ul>
+<li>foo</li>
+<li></li>
+<li>bar</li>
+</ul>
+.
+
+Here is an empty ordered list item:
+
+.
+1. foo
+2.
+3. bar
+.
+<ol>
+<li>foo</li>
+<li></li>
+<li>bar</li>
+</ol>
+.
+
+A list may start or end with an empty list item:
+
+.
+*
+.
+<ul>
+<li></li>
+</ul>
+.
+
+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.</p>
 .
 
 
-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:
 </ol>
 .
 
-A list item may be empty:
-
-.
-- foo
--
-- bar
-.
-<ul>
-<li>foo</li>
-<li></li>
-<li>bar</li>
-</ul>
-.
-
-.
--
-.
-<ul>
-<li></li>
-</ul>
-.
-
 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