Leading and trailing white spaces in code blocks

release-1.0

#21

Babelmark 3 report

Implementations that strip all leading and trailing spaces inside backtick spans and collapse internal runs of spaces (i.e. behavior currently specified by Commonmark):

  • commonmark.js
  • GitHub Flavored Markdown
  • league/commonmark
  • markdig
  • markdown-it

Implementations that strip all leading and trailing spaces inside backtick spans and keep internal runs of spaces:

  • blackfriday
  • cheapskate
  • DFM
  • earmark
  • markdown101
  • markdown102
  • MD4C
  • multimarkdown
  • pandoc
  • parsedown
  • php-markdown-extra
  • php-markdown
  • python-markdown
  • redcarpet
  • s9e/TextFormatter

Implementations that keep all leading and trailing spaces inside backtick spans and keep internal runs of spaces:

  • Cebe
  • Gambas
  • kramdown
  • Maruku

Implementations that trim one leading or trailing space inside backtick spans and keep internal runs of spaces (i.e. closest to desired behavior):

  • lunamark
  • rdiscount

#22

If the intention is to enable easy pasting of source code into backtick spans, then it would be good to think about how tabs should be dealt with too, as Go source code is indented with tab characters by all the standard tools.

Current behavior seems to be to pass them through verbatim?

Also, the tools use internal runs of spaces to vertically align code, so it would be good not to strip internal space runs.