Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds an attribute called
marker
tolist
nodes that preserves the marker symbol used for the list in the source document. For ordered lists, this is either)
or.
and for unordered lists it is either-
or*
. The marker is already exposed by the tokenizer, so the parser just has to take this value and assign it to the attribute.This PR also modifies the formatter so that it uses the marker provided by the source content when available instead of defaulting to a specific value. Previously, the formatter was programmed to always use
1.
for ordered lists and-
for unordered lists in order to enforce consistency.The problem that has arisen with this behavior is that in cases where there are two separate lists that appear in immediate succession in a document, the marker needs to be different in order for the parser to correctly identify them as separate lists. This behavior is demonstrated by Example 301 in the CommonMark specification. Making the formatter respect the original marker used in the source content ensures that it will not erroneously combine separate lists that appear in sequence.