4 ms·
I... never knew this. And since my editor strips newlines on save (and no, I will not turn that feature off), I guess I can't use it. Oh well. It kind of sca
by kentonv 11y ago
I... never knew this.
And since my editor strips newlines on save (and no, I will not turn that feature off), I guess I can't use it.
Oh well.
It kind of scares me that I might inadvertently strip the newlines out of someone else's markdown that I'm editing, though.
- mariusc23 11y agoIf your editor supports editorconfig[1], you could set it to not strip newlines for .md files. :) [1] http://editorconfig.org/ http://editorconfig.org/
- kentonv 11y agoBut I want to strip newlines from .md files.
- Animats 11y agoThat's why significant end of line whitespace is a terrible design feature. You can't see it. It might get deleted accidentally. There were some systems back in the DOS/early UNIX era which had significant EOL whitespace. Spaces at the end of a line are still significant following a "\" in shell files. Some early word processors under DOS had significant whitespace at EOL, but tended to display something like a paragraph mark when it mattered. Python had tab/space trouble at beginnings of lines, but the compiler was finally fixed so that it emits an error if tabs and spaces are mixed in a way which makes indentation visually ambiguous. That was a neat solution to the problem. Leading tabs in makefiles were a mistake. The author of "make" once wrote that he put that in, and then, the next day, realized it was a bad idea. But he already had a user base of three users and didn't want to change it and break their code. I thought this idea was dead and buried. Sometimes, they come back.
- BHSPitMonkey 11y agoFor what it's worth, GitHub Flavored Markdown changes this to be more TeXy: any newline in text renders as a <br>, and you add an extra blank line to denote a paragraph break.
- kentonv 11y agoUnfortunately that means that you absolutely need to enable word wrap in your editor, people cat-ing your readme on the shell will see ugly mid-word wraps, etc. Not the end of the world or anything, but somewhat inconvenient.
- Pxtl 11y agoThat sounds like a failure of cat more than a failure of markdown. There isn't a command-line argument for cat to break long-lines at the last whitespace of the line instead of mid-word?
- deleted 11y ago[deleted]
- Pxtl 11y agoMD could have been fine if it were the beginning of the line. "Any indentation without a blank line above is BR" It would make multiple repeated BRs difficult, though, but you probably shouldn't be doing that anyways.
- kentonv 11y agoErr, I of course meant "strip trailing whitespace", not "strip newlines", but apparently everyone understood.
- nemoniac 11y agoI never knew it either. Intriguing: significant white space on the right-hand side. At least you can see the significant whitespace in Python. I also have my editor configured to strip trailing whitespace but also to highlight it. People can be very sloppy leaving (insignificant) whitspace lying around in code.