0

I'm trying to represent a short inline span of code with a significant space or two at the end, using Markdown. If I were to put it in a stand-alone code block, it might look like this:

cd

Frustratingly, Markdown transforms `cd ` into <code>cd</code>, deleting the space at the end. How can I do it?

ʇsәɹoɈ
  • 22,757
  • 7
  • 55
  • 61

2 Answers2

0

Unfortunately, I'm not aware of a way to do this with backticks in vanilla Markdown. If you need to use your current parser, you can use literal <code> HTML tags to generate correct output:

Normal text. <code>Inline code block with a space: </code> Normal text.

If you're able and interested, switching to a more consistent/expanded parser (such as kramdown, which I've tested, but potentially also MultiMarkdown and others) correctly interprets terminal spaces in code blocks and doesn't truncate them.

Kyle Barbour
  • 985
  • 8
  • 25
-2

I don't believe markdown has anything for that specifically but if you use &nbsp; it will add a non breaking space. In your case replace

`cd  `

with

`cd&nbsp;&nbsp;`

and it should work as intended.

unor
  • 92,415
  • 26
  • 211
  • 360