Comment on Why does not a CR (Carriage Return) automatically start a new line on some online text editors?
TootSweet@lemmy.world 1 day ago
So, I think I kindof know what you’re getting at here, but you’re not being very precise about it.
First some definitions (just for purposes of this conversation – don’t take this to be any assertion that a particular term always inherently has a particular meaning, it’s just a tool for this conversation specifically):
- Character: a single unicode character.
- Plain text: unicode text absent any formatting.
- Source: the plain text to be fed into a Markdown renderer to produce rendered output.
- Rendered output: the formatted output of a Markdown renderer, as displayed to an end user.
- Editor: any computer program or component of a computer program for the entry of plain text.
- Line: text (plain text or rendered output, depending on context) rendered at the same vertical position.
- Line break: the point at which text (either plain text or rendered output depending on context) starts rendering on the next line because of a newline.
- Newline: a character that always forces a line break in an editor. (Remember “editor” is only about plaintext, so a newline doesn’t necessarily force a line break in rendered output.)
- Wrap: the point at which, absent a newline, text starts rendering on the next line due to column width constraints.
(As an aside a line break is sometimes accomplished with a “line feed” character. A “carriage return” character is something else that isn’t the same thing. Which is a big part of where the confusion comes from.)
What you’re saying, I think, is that putting a single newline in the source doesn’t result in a line break in the rendered output. Is that right?
In some editors (Vim being one I know of), when plain text word wraps, pressing “down” when the cursor is on the first line of a wrapped series of lines causes the cursor to jump not to the second line of wrapped text, but to the first line after the next newline. To illustrate:
If this line is wrapped due to being wider than the available width. And if this line is on its own line due to being immediately preceeded by a newline.
If your cursor in the above example was on the “w” in the first line there, pressing down would take the cursor to the space immediately before “is” in “And if this line is on its own line”.
As a result, it can be quite a pain to deal with word wraps in such editors. This is part of why certain code style guides (like this one and this one have hard limits for how many characters are allowed before the next newline.
Given how much more convenient line breaks can be than word wrapping, people writing source to be rendered into rendered output may wish to be able to insert newlines to cause line breaks in the source without causing any change in the corresponding rendered output.
That all make sense?
At least that’s most likely at least one reason why the people who invented Markdown decided specifically to make Markdown work that way.
schipelblorp@sh.itjust.works 1 day ago
Yeah, that makes plenty of sense, especially coming from a coding perspective and also from a perspective of compatibility with different width displays. Thanks!