November 11, 2007
<PRE> vs. <XMP>

I sometimes have the desire to display HTML code in a post rather than having the browser interpret it.

Lately, I have been using the wonderful WLW plugin Insert Code Snippet to accomplish this.

In my wanderings today, I learned about two alternatives - the HTML tags <pre></pre> (for preformatted text) and <xmp></xmp> which indicates a block of text where all HTML tags are ignored.  Of the two, <xmp> more precisely accomplishes what I want, but it is deprecated.

As an example, consider the following:

<> & &plusmn; <ahref="http://www.blogdom.org">test</a>

using the <pre> tag, you end up displaying:

<> & ± test

with the <xmp> tag, you get the full desired string of:

<> & &plusmn; <ahref="http://www.blogdom.org">test</a>

Interestingly, while entering this entry, I discovered that if I just type the HTML in any view other than the HTML Code view in WLW, what I type is what gets displayed in the blog entry (i.e. WLW translates the special characters into HTML entities rather than writing them to the blog for them to be interpreted by the browser).

Hmm...

Digg It!  Digg It!   del.icio.us bookmark  Bookmark it!  

Posted by David at November 11, 2007 08:13 PM
Comments
Post a comment

Ability to add comments removed due to spam.

If you wish to add a comment, send an email to comments at blogdom dot org

replacing the at above with @ and the dot above with .