Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 157 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

I frequently see examples of code containing < and > characters which get rendered incorrectly, because the tags aren't quoted as &lt; and &gt;. This seems to happen when using <pre><code> rather than indenting by 4 spaces. (See e.g. this StackOverflow post)

This often happens with:

  • code containing generics in Java and C#
  • C #include statements
  • testing for greater-than and less-than

The first one is particularly nasty, because the code doesn't look necessarily wrong (e.g. the user entered List<String> list = new ArrayList<String>();, but it appears as List list = new ArrayList();;

Please could StackOverflow either warn the user about this before posting or actually perform the rendering expected?

(Apologies if this is a duplicate; it's hard to search for < and >!)

share|improve this question
I'm hesitant, but my finger is twitchy wanting to tag this as a bug... – perbert Aug 29 '09 at 11:57

If you have a high enough arbitrary number, in this case, 2000, you could go help them out and edit the question yourself to improve the formatting.

Or you could flag it down for a mod to come along and fix it up for them.

Either way, it will leave an edit trail and allow the asker to then, if so inclined, look over the edit history and see what was done to achieve that formatting for future reference.

share|improve this answer
The correct solution is escaping all text inside code blocks. As I can't conceive anyone posting a link within code, SOFU could just escape all text within code blocks, and keep working the same way it does now. People can help in the meantime. – perbert Aug 29 '09 at 11:23
I do make the edits when I notice them. My point was you have to spot it (there's no visual difference between a <pre> block and a 4-space indented one unless you look at the markdown) – simonn Aug 29 '09 at 11:42

You must log in to answer this question.

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