Markdown inline-code collapses spaces

Summary

There's a big difference between grep '^ ' and grep '^ ' (and you currently don't see it when rendered by gitlab).

Steps to reproduce

  1. Put multiple adjacent spaces in an inline code block (`foo`) in

    • a Markdown file
    • an issue description / comment / …
    • or any other place that renders Markdown
  2. View rendered HTML.

Example Project

This issue's summary exhibits the same bug. (I think that's enough?)

What is the current bug behavior?

Multiple spaces collapse to a single space.

When inspecting the DOM in Firefox, the extra spaces are already gone. Manually editing the DOM node's text content to add more spaces updates the displayed HTML to show as many spaces as you added. This leads me to suspect that this isn't caused by lack of &nbsp; escaping in the Markdown output (which shouldn't be necessary in <code> nodes anyway), but instead by some phase of the conversion deliberately removing the spaces in error.

What is the expected correct behavior?

In `code` blocks, any number of inner spaces should be preserved as-is. (Outer spaces needed to separate `` `multi-backtick` ``-fences from the content should still go away.)

Checklist:

  • a b looks like a b NOT a b
  • make `uname` (still) looks like make `uname` NOT make `uname`

Output of checks

This bug happens on GitLab.com

Possible fixes

(no idea / did not dig into the code)

Workaround

Use <code>…</code> instead of `…` where necessary. (And remember to escape backticks and anything else that needs escaping – <code>make \`uname\`</code> etc.)

Assignee Loading
Time tracking Loading