?
Solved

How to add code syntax highlighting to blogger

Posted on 2012-04-04
8
Medium Priority
?
370 Views
Last Modified: 2012-04-27
I'm new to blog. I would like to add my powershell code to the blog. I had difficulty to follow below links.


http://www.craftyfella.com/2010/01/syntax-highlighting-with-blogger-engine.html

http://alexgorbatchev.com/SyntaxHighlighter/

I try to use syntaxhighlighter to add code but i have difficult to follow their instruction:


Installation


Basic Steps

To get SyntaxHighlighter to work on you page, you need to do the following:
1.Add base files to your page: shCore.js and shCore.css
2.Add brushes that you want (for example, shBrushJScript.js for JavaScript, see the list of all available brushes)
3.Include shCore.css and shThemeDefault.css
4.Create a code snippet with either <pre /> or <script /> method (see below)
5.Call SyntaxHighlighter.all() JavaScript method

<pre /> method

ADVANTAGES: Works everywhere, graceful fallback if there are script problems, shows up in all RSS readers as regular <pre />

PROBLEMS: Major issue with this method is that all right angle brackets must be HTML escaped, eg all < must be replaced with &lt; This will ensure correct rendering.

SyntaxHighlighter looks for <pre /> tags which have a specially formatted class attribute. The format of the attribute is the same as the CSS style attribute. The only required parameter is brush (see configuration), which should be set as one of the brush aliases

Start from step1, i already no idea to do that.

Please advice
0
Comment
Question by:suriyaehnop
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 37809537
Is this Blogger or WordPress?
0
 
LVL 19

Author Comment

by:suriyaehnop
ID: 37809581
Wordpress and blogspot. I have 2 blogs
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 37809587
Wordpress.com or self-hosted?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 19

Author Comment

by:suriyaehnop
ID: 37809609
sorry// wordpress.com
0
 
LVL 70

Accepted Solution

by:
Jason C. Levine earned 1200 total points
ID: 37814393
For Wordpress.com all you need to do is put the code in the sourcecode shortcode per their instructions:

http://en.support.wordpress.com/code/posting-source-code/

Example:

[sourcecode language="css"]
your code here
[/sourcecode]
0
 
LVL 19

Author Comment

by:suriyaehnop
ID: 37826271
Working on wordpress.com. Do you how to enable it on blogspot also?
0
 
LVL 12

Expert Comment

by:Anuradha Goli
ID: 37827488
You can add as per instructions shown in link
http://heisencoder.net/2009/01/adding-syntax-highlighting-to-blogger.html
if any doubts please let me know
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question