Skip to content

Instantly share code, notes, and snippets.

@patcon
Last active October 28, 2019 19:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save patcon/38f6930b29bd86cf2e42626f20b89a30 to your computer and use it in GitHub Desktop.
Save patcon/38f6930b29bd86cf2e42626f20b89a30 to your computer and use it in GitHub Desktop.

This is a doc to show how newlines work equivalently on GitHub.

Failed newlines

line 1 line 2

line 1
line 2

Newlines via double-space at end-of-line

line 1, 2 spaces=>
line 2, no spaces=>

line 3, 2 spaces=> line 4, 2 spaces=>

line 1, 2 spaces=>  
line 2, no spaces=>

line 3, 2 spaces=>
line 4, 2 spaces=>  

Newlines via escaped newline at end-of-line

line 1, with slash=>
line 2, without slash=>

line 3, with slash=>
line 4, with slash=>\

line 1, with slash=>\
line 2, without slash=>

line 3, with slash=>\
line 4, with slash=>\

Conclusion: If using slash escapes, makes preserved newlines explicit, but strictly can only use escaping in middle of <p>, not at the end, or the slash will show up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment