Sometimes I use HTML <pre><code>…</code></pre>
instead of Markdown ```…```
/ ␣␣␣␣…
blocks for code blocks with inline text formatting. I have noticed recently that such inline formatting is now stripped out by the automatic syntax highlighting on Stack Overflow.
Can this be reverted so that the formatting is preserved?
(What follows is just my reasoning and some examples.)
Other prolific and eminently helpful users like Willem van Onsem also use this type of formatting very often, and this change disrupts important elements of the presentation of many of their answers, while I think it’s important that it be preserved. Furthermore, inline formatting is more accessible to screenreaders than strictly visual workarounds like underlining with comment delimiters, even without using semantic HTML tags. (I’d certainly be happy if support were added for them, but that can be a separate feature request.)
On my recent answer, in the editing preview as well as the rendered post, I noticed that using a <pre>
+ <code>
block with syntax highlighting enabled would strip out the formatting tags. As a workaround there (and in this post) I’ve used <!-- language: lang-none -->
, which is okay sometimes but not ideal in general.
I typically use inline formatting of code in the following situations:
I want to draw attention to a section of the code as either important or non-verbatim in some way (user- or programmer-specified) using respectively
<strong>
and<em>
, the latter because the semantic<var>
is not supported.two = numeric expression four = two + two
I want to use
<a>
to add inline links to documentation for functions and types used in the example.I want to illustrate a “diff” to the code in the question, typically using the
<strong>
tag and deprecated<strike>
tag, because while the semantic<del>
tag is supported by the CSS, the matching<ins>
is not.two = 2
four = 5-- You had a typo here. four = 4 main = print (two + two == four)I have tried to use
diff
/patch
highlighting as a workaround, but these are not enabled languages for syntax highlighting. Also, without some special treatment like copy/paste support, I consider this less suitable for the kind of beginner question I tend to answer this way (e.g. to correct several minor syntax errors without taking a lot of space).
<!-- language: lang-none -->
is no longer supported. At best use<!-- language-all: lang-none -->
at the start of your post.