Zettelkasten Forum


[Markdown Best Practices] Two Spaces = New Line = Lame

Can someone with more historical knowledge of markdown or coding explain to me why some apps (thankful not The Archive), require two spaces after a line for it to recognize a New Line (ie a Carriage Return)?

Here's an example of the, in my opinion, non-optimal behavior. This:

Is previewed as this:

Comments

  • edited September 2019

    Some speculation from my side: it's not that 2 spaces have a special meaning, but that line breaks on their own were supposed to become meaningless. There are people who add line breaks at around the 80 characters mark either manually or with the help of their text editor, so a single paragraph is stored as multiple lines in the text file, each supposed to be short enough to be readable in the dumbest of terminals.

    With modern editors that do automatic visual line-wrapping, this seems utter nonsense.

    Just look at the source of the Markdown project page to see this in action:
    https://daringfireball.net/projects/markdown/index.text

    I guess adding 2 spaces to the end of a line for manual line breaks were the next best thing that wasn't overly complicated to enforce preservation of the line break when transforming the text to HTML. The transformation was very simplistic: for every line ending in 2 spaces, add a <br> line break in HTML; surround text blocks with <p>/</p> paragraph HTML tags, separated by empty lines. That's it; no desktop publishing or note-taking considered in the design.

    Author at Zettelkasten.de • https://christiantietze.de/

  • @ctietze Thanks for your commentary; that answers my question fully!

Sign In or Register to comment.