Make an distinction between Unicode whitespace and regular whitespace #107
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.
The spec makes an distinction between "whitespace" and "Unicode whitespace": whereas the latter include many additional whitespace characters, particularly the non-breaking space (U+00A0), the former does not.
Per ECMA-262 6th Edition ("ECMAScript 2015") §21.2.2.12 CharacterClassEscape, the JavaScript
\s
escape character matches the characters specified by "Unicode whitespace," but not "whitespace."To fix this issue, rename the existing regular expression variable to
UnicodeWhitespace
, and create and use a new regular expression variable that only matches the limited set of "whitespace" characters.The test suite does not yet cover this distinction. I will add a corresponding test case when this pull request has been accepted.
For additional information, the distinction in the spec was challenged and reaffirmed by commonmark/commonmark-spec#343.