1
\$\begingroup\$

The markdown parser mangles code inside <pre> tags and white space. this becomes quite apparent when posting code that is sensitive to white space, such as self printing code. I made a little one line tool to help, but it is still anoying. sed 's/^/ /' quinine |xclip

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

Try indenting each line by 4 spaces instead of writing <pre> tags manually. You can do this easily by selecting the block of code and clicking the {} button in the editor toolbar, or pressing CtrlK.

\$\endgroup\$
3
  • \$\begingroup\$ Indeed this helps, and is basically what my little script does (although it uses a tab), but this is an error prone method to do by hand, which is why I wrote a script. ponder for a moment a brief script of 15 lines. If the pre tags worked it would be nine characters and only two places to make a mistake instead of 60 characters and at least fifteen places to make a mistake. The place that gave me the most trouble is long lines, I kept trying to add four spaces at the wrap. \$\endgroup\$
    – hildred
    Commented Dec 19, 2013 at 19:53
  • \$\begingroup\$ @hildred It's not "error-prone", in that you highlight the block and click the {} button in the editor toolbar (or press Ctrl-K). Lemme suggest the same thing in the answer prose itself. :-) \$\endgroup\$ Commented Dec 19, 2013 at 20:21
  • 1
    \$\begingroup\$ Ah, at last something that the toolbar does better than just typing it in. That is the piece of information I was missing. \$\endgroup\$
    – hildred
    Commented Dec 19, 2013 at 20:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .