Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 158 Stack Exchange communities.

What is meta?
Here's how it works:
  1. Any Stack Exchange user can ask a question
  2. The community provides support, votes on ideas, and reports bugs
  3. Your voice helps shape the way Stack Exchange operates

This question already has an answer here:

In this question, I noticed that the code I had pasted in a <pre> (should I really be going through the manual labor to indent four lines) wasn't displaying crucial parts of the raw source.

They were angle bracket-delimited bits of Python error-code: to render <class 'taggit.models.TaggedItem'> I had to escape the opening bracket and give &lt;class 'taggit.models.TaggedItem'> — take a wild guess what I did to display the latter. My browser, Chrome, originally saw an unrecognized class tag, and like a good browser ignored it without display.

I know that limited HTML is permitted, but could angle brackets be escaped for code not on a whitelist of permitted HTML tags, including all tags that are not any form of valid HTML tags?

share|improve this question

marked as duplicate by Time Traveling Bobby, Bo Persson, Martijn Pieters, Toon Krijthe, ChrisF May 9 '13 at 7:54

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

@downvoter, read the question, this is a legitimate question for meta. – ryan Mar 25 '13 at 15:50
@ryan: That has nothing to do with downvotes. Neither on the main site nor hear on Meta. – Time Traveling Bobby Mar 25 '13 at 15:50
@SulfurizedDemonbobby yes I know, downvotes are for disagreeing, but who would disagree with this? the editor sucks in a lot of different ways. why would you not want the editor fixed to do more for you automatically ?? – ryan Mar 25 '13 at 15:52
@ryan: Downvotes are different here on Meta. Someone doesn't see a need for changing the formatting, it's a vote on the feature request. – Martijn Pieters Mar 25 '13 at 15:52
@MartijnPieters ... le sigh, I know how it works, as it was this wasn't tagged feature request, I changed the tag, it was tagged as a bug when it was downvoted. – ryan Mar 25 '13 at 15:53
@ryan: You can still vote for it not being a bug in that case.. – Martijn Pieters Mar 25 '13 at 15:54
@ryan: You might want to read this. – Time Traveling Bobby Mar 25 '13 at 15:54
@ryan: Also, maybe someone does not agree that there is something to fix or implement (f.e. do it right and it will work). – Time Traveling Bobby Mar 25 '13 at 15:55
@SulfurizedDemonbobby I have read that... and I didn't ask for comments... where did I ask the downvoter to comment? – ryan Mar 25 '13 at 15:55
@ryan: Yes, you instead harassed the voter...that's just as pointless. – Time Traveling Bobby Mar 25 '13 at 15:57
I don't understand the question. When writing HTML-tags in a code block, these are rendered instead of interpreted - even without escaping them. Like this <b>This is not bold code</b>. Or am I missing something here? – Spontifixus Mar 25 '13 at 15:58
@Spontifixus If you go to the question and click on "edit", you'll see that it's actually not a code block but a <pre> block. – Juhana Mar 25 '13 at 15:58
Somewhat related:… – Tim Stone Mar 25 '13 at 16:04
@Juhana Having inline tags is no problem, when using the default (markdown) way of including code. 4 blanks or a backtick... – Spontifixus Mar 25 '13 at 16:08
@Spontifixus Yes, that is correct. And the OP asked this question because he didn't use the default way to include code. – Juhana Mar 25 '13 at 17:03

Don't use <pre> to format code. Indent with four spaces or highlight the text and click on the "code sample" button in the editor (icon with curly brackets).

<pre> preserves tags (and SO software proceeds to immediately strip them out) but actual markdown code formatting automatically encodes <, > and other characters to HTML character entities.

Demo (click on "edit" to see the source):


Hello World!

Markdown formatting:

<strong>Hello</strong> <em>World!</em>
share|improve this answer

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