6

https://stackoverflow.com/help/formatting

Like code blocks, code spans will be displayed in a monospaced font. Markdown and HTML will not work within them. Note that, unlike code blocks, code spans require you to manually escape any HTML within them.

Really?

It seems that I can safely write <blink>test</blink> <marquee>test</marquee> without any manual escaping.

1
  • 1
    I've opened a related post here.
    – Jason C
    Apr 26, 2017 at 17:24

2 Answers 2

4

The help text is clearly incoherent.

Markdown and HTML will not work within them.

Correct for backtick-delimited spans; incorrect for <code> spans, and of dubious relevance anyway, as they work like all other HTML tags. Behold Markdown bolding and HTML strikethrough here: Testing.

Note that, unlike code blocks, code spans require you to manually escape any HTML within them.

Totally wrong for backtick-delimited spans; correct for <code> spans. Contradicts what was just said, since any context in which you can't use HTML, you certainly don't have to escape it.

1
  • Yes, it is very poor wording in the help center. They use "code block" to refer to the 4-space indented form, and "code span" to inconsistently refer to chunks of text between <code> tags, and neither one of those covers backticks (except for that one part where they say "inline <code> span"... yeesh), even though the latter is mentioned in the backtick section of that article. If you read the whole article, the incoherence becomes even more pronounced. It is very confusingly organized with lots of ambiguous terms.
    – Jason C
    Apr 26, 2017 at 16:46
1

"Code span", in this context, means this:

<pre><code><blink>test</blink></pre></code>

Which renders as:

test

So to preserve the HTML you need to replace "<" with "&lt;":

<blink>test</blink>

2
  • 1
    The article also says unlike code blocks. So, in this context, "code blocks" means code blocks created with Markdown, but "code spans" means code spans created without Markdown?
    – unarist
    Mar 27, 2017 at 14:21
  • @unarist as far as I can tell then yes, that's the meaning Mar 27, 2017 at 14:25

You must log in to answer this question.

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