Export to GitHub

lesswrong - issue #348

Markdown: whitespace is not preserved in preformatted blocks.


Posted on Sep 14, 2012 by Swift Wombat

To reproduce, leave a comment like the following, but with "+" characters replaced with spaces:

++++foo ++++++++bar ++++baz

++++quux++++quuux

Expected HTML output is as follows (with "+" characters replaced with spaces). Note that the "bar" line is indented, the "baz" line has a blank line after it, and the fifth and last line has four spaces between "quux" and "quuux".

<div class="md"><pre><code>foo ++++bar baz

quux++++quuux </code></pre></div>

Actual HTML output is as follows. Consecutive whitespace characters have all been squeezed to a single space or newline.

<div class="md"><pre><code>foo bar baz quux quuux </code></pre></div>

The leading spaces, consecutive newlines, and consecutive spaces are preserved in the Markdown source code (available via the edit button).

(Pretty sure this is server-side; I have reproduced it by posting comments with Firefox 14.0.1 on Windows XP and with old versions of Firefox and Chrome on Linux.)

Another user has noticed this:

http://lesswrong.com/lw/ehz/the_rawexperience_dogma_dissolving_the_qualia/7fpe

Comment #1

Posted on Jun 6, 2013 by Happy Wombat

I noticed this issue while including R code for my analyses of the 2012 LW survey (eg. http://lesswrong.com/lw/fp5/2012_survey_results/7zok ); the indentation makes the results more readable, and so its loss is too bad.

Status: New

Labels:
Type-Defect Priority-Low Milestone-Future