Display HTML,Javascript and XML Code In Blogger Post

Posted In Blogger, Blogger Hacks - By Piyush Dungrani On Friday, November 13th, 2009 With 1 Comment

After giving a firefox add on for Adding XML, HTML and JavaScript as plain text in your blogger post i will give you another method from which you can do the same thing, in fact this is the one that i am using right now to display any code as a plain text. see BreadCrumbs in Blogger.

Let’s first address the issue why you can’t directly put the code as plain text in you post?, the answer is Web browsers are smart as you give them code they render them into pictures and display on the monitor. There are few solutions available on the internet to show your code as plain text in your posts, but what I am going to show you is the best one i have ever used.

Syntax Highlighter is the ultimate solution For Displaying any types of Codes and Scripts In Blogger posts, it uses JavaScript library, does the highlighting using CSS, and supports many programming languages.

 Display HTML,Javascript and XML Code In Blogger Post

Follow the steps given below to add this functionality in your blog.

Some prerequisite Steps:

1. Download the scripts. You can download all the required script files here.

2. Extract the files and upload them to your server. Upload only the needed files, you’ll find out the one you need as you read along. If you don’t have a file host (or onBlogger like me), don’t despair, there is a free hosted versions like http://www.hotlinkfiles.com/ and http://www.mydatanest.com/.

3. Link the files to your pages. For the purpose of this demonstration it will be assumed that scripts/*.* was extracted and placed into /scripts folder and styles/*.* into /styles.

Now Modify and insert these codes into the Header segment of your page/template as given below:

 
 
 <script type="text/javascript" src="/scripts/shCore.js">       

Now SyntaxHighlighter looks for


tags (pre-formatted text) which have specially formatted class attribute. The only required parameter is brush (see configuration) which should be set to one of the brush aliases that you have loaded previously. You need to switch to source code mode to do this.

Here’s a typical example:


 enter your code snippet here

Now Publish your post and you have done ! icon smile Display HTML,Javascript and XML Code In Blogger Post as usual if you have any doubt then let me know, i love comments icon smile Display HTML,Javascript and XML Code In Blogger Post

Incoming search terms:

HTML and JavaScript, blog script, xml blog script, xml and javascript use in html, what program to display a blog from xml, text post hack html codes, javascript codes, javascrips, html scripts, How to display the Scripts and Codes, different designs displaying html javascript css and other code into blogger post, codes scripts, blogspot post xml, blogspot display xml code, blog xml file render html

About - A techie by profession (software engineer) and a part time blogger by choice with immense knowledge of SEO, also writes articles on Google, Microsoft, Apple, iPhone, Internet, Blogger, Social Media and windows. Catch him on Twitter, Join Facebook Fan Page. Subscribe to GeekBlogger feed via RSS or EMAIL to receive instant updates.

Displaying 1 Comments
Have Your Say

  1. Piyush says:

    Please Refer the Following instructions for Adding XML Code as Plain Text in Blogger.

    1) Parse(Encode) first code with this editor : http://centricle.com/tools/html-entities/
    2) Paste The Encoded Text between

     Parsed (Encoded) Code

    Comment if you need any more help. :-)

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>