There is Carriage Return (CR), and also Line Feed (LF, often called New Line). If you think about old mechanical printers with the metal arm sticking out, a CR operation would move the type head to the far left column, and a LF operation would advance the paper by one line. Variously through the years depending on hardware (typewriter, teletype, those early CRTs that you had to refresh the screen, or modern computers) you would get one or both of those if you pressed Return/Enter, and it’s configurable in software, depending on the software. I don’t know what windows does these days with notepad, but at one time the Enter key sent both (CRLF). UNIX style systems tended to use LF, and older Macs as someone else referenced used CR. If you wrote a generic program to handle anything you had to account for all of them. Mostly these days it gets abstracted away which generally works well enough unless a team of people used a random collection of software to edit a text file.
printf "\r\nHexadecimal, like that scene from The Martian.\n" | hexdump -C 00000000 0d 0a 48 65 78 61 64 65 63 69 6d 61 6c 2c 20 6c |..Hexadecimal, l| 00000010 69 6b 65 20 74 68 61 74 20 73 63 65 6e 65 20 66 |ike that scene f| 00000020 72 6f 6d 20 54 68 65 20 4d 61 72 74 69 61 6e 2e |rom The Martian.| 00000030 0a |.| 00000031
The 0a is a Line Feed character, and the 0d is a Carriage Return character. In my terminal without piping it through hexdump you get:
printf "\r\nHexadecimal, like that scene from The Martian.\n" Hexadecimal, like that scene from The Martian.
The LF at the end of the string makes it so that the prompt at the terminal doesn’t appear on the same line as the output, and the blank line before the text is caused by the LF at the beginning. I don’t know/care/have to worry about what eats the CR.
marcos@lemmy.world 1 week ago
So, it is about markdown.
It’s this way because people want to break their editable text into lines without making the final text break paragraphs. People write entire books in markdown, but it does become unsettling when you use in social media comments.