Hacker News new | past | comments | ask | show | jobs | submit login

Markdown is not plain text. Markdown destroys your single newlines. Plain text does not.





Markdown is plain text.

The output of Markdown processing is not.

Markdown is intended to be readable without processing as its syntax is mostly based on plain text email conventions. You should consider the ability to process Markdown to another output format to be an almost incidental benefit to using Markdown, rather than its primary function; meaning, Markdown syntax conveys semantics even without processing.

Its line behavior is based on plain text email client conventions, and plain text editor behavior, which many do not by default perform line wrapping, nor necessarily should, depending on user preference. Meaning, a Markdown file should be readable with line wrapping turned off, hence why it consumes line breaks, unless you use two spaces at the end of a line to override this behavior. (Think of the two spaces as an invisible rendering hint to Markdown processors.)

Email line length specifications: https://tools.ietf.org/html/rfc2822#section-2.1.1


Yes, Markdown is like HTML, its input is a plain text format but its output looks different (your single newlines get removed from the output, because single newline has a different meaning in the source code than in the output, unlike in real plain text, where they stay newlines)

> and plain text editor behavior, which many do not by default perform line wrapping

Not true, in a plain text editor you can make ascii art, or a dashed list of items, without having to type special syntax, and it will not become one long line

Dynamic line wrapping for display is something different than removing newline characters ("\n") you type in the string. Markdown does the latter. Text editors do not remove newlines you type.

> plain text email client conventions

I don't think plain text email ever removes a deliberate newline you type either. Does it?




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: