#Line breaks \
9 messages · Page 1 of 1 (latest)
it is a good practise, for example, to put every sentence in a separate line in your code such that line based diffs (as you'd have in git) work on semantic units. personally, i also limit my code lines to 80 characters as well to ensure readability regardless of the editor. in both cases, i wouldn't want the syntactic linebreaks in my code have an effect on the rendered document. that's why LaTeX, Typst, and (certain implementations of) markdown ignore single \n characters in your code
Can you give me an example where you use \n, don't want a linebreak and automatic line wrapping by editor doesn't suffice?
This is a short sentence.
This is another.
Because I prefer hard-wrapped lines to soft-wrapped lines.
I don't split my lines per-sentence, I instead just wrap them at 80/100/120 depending on the language I'm using. Not only do I simply prefer it, but like a5sk6n says, it gives line-based source control more stuff to grab onto.
Ok, in such case, why not make \n\n equal to \n and \n\n\n equal to \n\n?
...or, why not make \n equal to and make \n\n equal to \n? 😛
Another reason is that hard-wrapping lines at some specific column with line-feeds is an established convention, especially in the early computing space. Everything was on a terminal and nothing was consistent, Things were written that way to make sure stuff was legible either in plain-text, terminal form, or in email or printed or wherever else.
Just look at RFCs: Both of TCP and IP's original documents are hard-wrapped at 72 characters. New ones are, too.