8

I tried to insert b> in comments, but I could not do this, it rendered as a standard text with backticks. Why? How to insert this code:

`   text` 

in comments so it renders as text with three visible spaces?

10
  • Test: ` text` and ` text` and ` text` and ` text` Jun 17, 2015 at 6:17
  • 1
    Test comment markup: ` text`, ` text`
    – aroth
    Jun 17, 2015 at 6:17
  • @aroth: how to render this as a code without backticks? Jun 17, 2015 at 6:19
  • Don't know, haven't stumbled upon a functional way to do that yet. Even Unicode whitespace characters seem to throw it off.
    – aroth
    Jun 17, 2015 at 6:21
  • So, it is impossible to render at least one visible space at the beginning and no spaces at the end? Jun 17, 2015 at 7:41
  • Precede with ZWSP, then NBSP for multiple spaces ​    text
    – nhahtdh
    Jun 17, 2015 at 7:50
  • Btw, I covered it here: meta.stackexchange.com/questions/175364/… which is closed as dup of meta.stackexchange.com/questions/105316/…
    – nhahtdh
    Jun 17, 2015 at 7:54
  • @nhahtdh: Thank you. Yes, duplicate! But strange, those answers were not shown by search when I tried to find a solution. Currently, they are not even shown here on this page, at the right side... Jun 17, 2015 at 7:58
  • @lyricallywicked: It's on Meta.SE (The Great Meta), not Meta.SO (here).
    – nhahtdh
    Jun 17, 2015 at 7:59
  • @nhahtdh: Ah, yes. Anyway, I did not managed to find them using search engines (incl. Google) by keywords. Jun 17, 2015 at 8:02

1 Answer 1

3

A solution/workaround was pointed out in the comments (use a unicode char).

However, this question also asked "why?"

It is all explained in the official?/original Markdown Syntax Rules:

The backtick delimiters surrounding a code span may include spaces — one after the opening, one before the closing. This allows you to place literal backtick characters at the beginning or end of a code span:

A single backtick in a code span: `` ` ``

A backtick-delimited string in a code span: `` `foo` ``

will produce:

<p>A single backtick in a code span: <code>`</code></p>

<p>A backtick-delimited string in a code span: <code>`foo`</code></p>

To enforce that rule, Markdown parsers generally will strip any white-space at the beginning and end of the code span. As the rules specifically state "one after the opening, one before the closing" it could be argued that only one space should be removed rather than all of them. However, it can be difficult for a document author to tell the difference between one and two spaces, so the parser (correctly IMO) assumes that the extra spaces were a typo and removes them all. This was the behavior implemented in the original reference implementation (markdown.pl), and all (most?) other implementations have copied that behavior.

You must log in to answer this question.

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