Sometimes you want to write something with broken lines and you write in the editor:

That’s right I’m Sokka
It’s pronounced with an Okka
Young Ladies, I rocked ya!

But it ends up looking like this:

That’s right I’m Sokka It’s pronounced with an Okka Young Ladies, I rocked ya!

The fix is to add two spaces between the final character and the carriage return.

I don’t understand what the problem is. CR should be easy enough to translate, and the users intentions are clearly confirmed because they’re looking right at what the expect it to look like when they hit submit.

Why does the user have to add two spaces? Why is the universe like this?

Edit: Holy Shit, look, I’m just an idiot typing text expecting WYSIWYG and I don’t see a good reason for why I’m not getting it other than that programmers lack theory of mind.

  • TootSweet@lemmy.world
    link
    fedilink
    English
    arrow-up
    0
    ·
    11 days 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.worksOP
      link
      fedilink
      arrow-up
      0
      ·
      11 days 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!