The solutions suggested so far seem to deal with wrapping issues in paragraphs, but not in lists.
Consider this example:
This sentence has been wrapped by
1. This is not a new list item.
1. An actual new list item.
2. Another new list item.
As already noted, this ambiguity can be solved by requiring a blank line before the list.
Now consider the case where the opening paragraph is itself a list item at the same level as the other list items:
1. This sentence has been wrapped by
1. This is not a separate list item.
2. An actual new list item.
3. Another new list item.
Solving this ambiguity requires a blank line before every new list item, not just the first item in the list, or even the first item at each new sublist level, like this:
1. This sentence has been wrapped by
1. This is not a separate list item.
2. An actual new list item.
3. Another new list item.
Perhaps the choice should be between:
-
Always requiring a blank line before every new item in a list, including the first one.
- This obeys the Principle of Uniformity and avoids ambiguity with line wrapping, setex, etc.
- However, it is clearly a major change to current practise, and interferes with the definition of loose lists.
-
Never requiring a blank line before any new list item, not even the first one.
- This obeys the Principle of Uniformity and is consistent with current practise.
- However, it requires escape characters or special heuristics to resolve issues with wrapping and setex.
My preference would be to never require blank lines before list items, and to use heuristics to determine whether something is a new list item or a continuation of the previous paragraph/list item. I know you guys are (understandably) reluctant to use heuristics, but they do have these benefits:
- A human reading the text is essentially using heuristics to determine what is and is not a new list item. Commonmark would essentially just be codifying this process.
- The heuristics don’t have to be perfect and can be improved over time as more edge cases are revealed.
- If there are exceptional cases where the heuristics get it wrong people can always use blank lines and escaping to get the result they intended.
- Heuristics can obey the Principal of Uniformity. The same heuristics can be applied at any sublist level to determine whether a new line is:
- A) a continuation of the previous line.
- B) a new list item at the same level of the previous item.
- C) a child of the previous list item (i.e. a new sublist item)