Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recognize CR-LF pairs as newlines for the purposes of Paragraph separation. #60

Merged
merged 3 commits into from
Apr 7, 2023

Conversation

jimstudt
Copy link
Contributor

@jimstudt jimstudt commented Nov 3, 2020

Currently if the source text is using DOS style CRLF newlines they will not be recognized as paragraph separators when a blank line is built from them. This is a common occurrence if you wish to accept input from web browsers.

This adds a ridiculously tiny code change to recognize the CRLF newline variant and contains a couple tests for verifying both regular LF-LF and CRLF-CRLF paragraph delimiters.

I didn't find any definitive statement on what Markdown accepts as newlines, but given the generally loose definition it seems reasonable to permit this.

jimstudt and others added 3 commits November 3, 2020 13:42
The DOS CRLF sequence does not pass its test without more code.
Keep in mind that "\r\n" is a single Character as far as Swift is concerned,
so this looks a little weird if you were expecting CR and LF to come in as
separate characters.
Possibly consider redoing the logic on the line to test nextCharacter.isNewLine
apart from the nextCharacter.isAny test to catch the other control character
and Unicode oddities which count as newlines, since the outer "if" statement
is also using that test.
Copy link
Owner

@JohnSundell JohnSundell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for taking so long to review this PR, @jimstudt, and thanks a lot for fixing this issue!

@JohnSundell JohnSundell merged commit bcc9f21 into JohnSundell:master Apr 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants