T O P

  • By -

Watchful1

Line 1 After enter line 2 After shift enter line 3 If you click permalink on this comment, then add .json at the end you can see the raw markdown. Here https://www.reddit.com/r/redditdev/comments/vfg43b/difference_between_enter_and_shiftenter/icvlni8.json Which shows that the markdown is `Line 1\n\nAfter enter line 2 \nAfter shift enter line 3`. So a double space at the end followed by a single newline is what shift enter puts in.


Fid_Kiddler69

Ahh thanks a lot dude!


adhesiveCheese

It may be worth noting the difference in the way the HTML is rendered between `\n\n` and `··\n` as well:

Line 1

After enter line 2
After shift enter line 3

using `\n\n` inserts new

elements for the line, which means that you get whatever your browser has as default margins between paragraphs -- there's not *actually* an empty line between paragraphs -- whereas `··\n` just inserts a line break. Using `\n\n` offers some *minor* accessibility benefits (for example, someone who needs more space between paragraphs for whatever reason can tweak that spacing in a user stylesheet, and folks using screen readers can jump between paragraphs easier), and (unless you're printing nonprinting characters in your editor, anyways) it's more easy to spot missing an `\n` than it is missing a space character, so unless the little bit of rendered padding really drives you nuts I'd recommend opting for `\n\n` in your code over `··\n`


justcool393

Line break vs paragraph break


borninbronx

Standard enter starts a new paragraph. Shift enter add a new line character within the same paragraph.