Skip to content

Conversation

@npmccallum
Copy link

  1. Replace three consecutive dots with the ellipsis character.
  2. 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.
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.

1 participant