-2

Possible Duplicate:
How do I format my code blocks?

Whenever I try to use HTML tags for a code example on stack overflow, the actual HTML is used on the page, instead of being escaped. To make matters more difficult, only some of the tags are not escaped, making code samples with HTML in them next to impossible. The raw textbox (where I am trying right now) is filled with ampersands and semicolons!

Is this normal, or is there just a problem with by browser or account? Am I missing something here?

EDIT: Yes, I know that you're supposed to indent code with 4 spaces. This only works for about half the tags.

4
  • Indent your code by 4 spaces. This will treat all the text as literal string.
    – nhahtdh
    Commented Jun 19, 2012 at 5:15
  • doesn't work all the time, only works for about half of the tags.
    – alecwhardy
    Commented Jun 19, 2012 at 5:17
  • 4
    Can you show some example?
    – nhahtdh
    Commented Jun 19, 2012 at 5:21
  • Stack Overflow has code blocks, read the linked faq to see how you can achieve those. Commented Jun 19, 2012 at 6:18

1 Answer 1

-1

I think you may find your answer here? Apparently there is limited support for HTML tags. The post lists the tags you can use.

Post: What HTML tags are allowed on Stack Exchange sites?

<a>
<b>
<blockquote>
<code>
<del>
<dd>
<dl>
<dt>
<em>
<h1>, <h2>, <h3>
<i>
<img>
<kbd>
<li>
<ol>
<p>
<pre>
<s>
<sup>
<sub>
<strong>
<strike>
<ul>
<br/>
<hr/>

Read the post itself for more information.

1
  • 2
    That post relates to what is allowed OUTSIDE code examples, I.E. mixed with markdown. The question is regarding code examples.
    – Jon P
    Commented Jun 19, 2012 at 5:56