Open
Conversation
npmccallum
commented
Sep 28, 2017
- Replace three consecutive dots with the ellipsis character.
- Fix control character handling.
Lots of effort goes into escaping the periods. Instead, let's just replace the three consecutive periods with an ellipsis character. This decreases the size of the output and doesn't get interpreted as a control character.
The current attempt at escaping control characters had a number of problems. First, it would replace a single-quote character with a backtick. This means that if you used single-quote characters in a code example, it would be replaced with an incompatible character. This resulted in code examples that couldn't be copy-pasted. Second, it replaced all characters that could be control characters, regardless if they were in control position or not. Only the first character on the line is potentially a control character. The previous code, however, replaced all possible control characters, leading to bloating in output. Third, the documented way to escape control characters was not followed. We should escape them by inserting a zero-width character in the control character position (first character on the line). This was partially done, but only for periods and not other control characters. This patch should correct these issues so that control characters are properly escaped in all instances.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.