How to show html examples without them being interpreted as html  

Posted by shashank

If you try and simple copy paste an html example in a visual editor it may be interpreted as html and hence you may get an error. So if you want to display an html example on your website or blog implement the following algorithm:

1. Open the example in a text editor.
2. Replace all "&" by "&amp".
3. Replace all "<" by "&"(no space)"lt;".
4. Similarly replace all ">" by "&"(no space)"gt;".
5. Copy this edited test to the html code of your page and publish it.


That is all there is to it! Your example will be displayed on your page. I hope you have understood my problem in making the points 3 and 4 appear the way they are. Just ignore the (no space).

This entry was posted on Monday, April 20, 2009 at 2:56 PM . You can follow any responses to this entry through the comments feed .

0 comments

Post a Comment