blogger: syntax highlighter
install
Download the code from google.
Copy the brush files to a server.
Then paste the script code in your template. I use a html/javascript widget in the footer for this purpose.
Finaly link to the stylesheet, place this before the </head> tag in the template.
<link type="text/css" rel="stylesheet" href="http://path/to/your/server/SyntaxHighlighter.css"></link>
usage
<pre name='code' class='lang'>
code snippet...
</pre>
Choose lang from the aliases in the table, you also need to load the corresponding brush.
modifications
I had to remove the background for the li elements in the css file.
configuration
These options allow you to individually configure text blocks.
The options are passed together with the alias and are separated by a colon : character.
Download the code from google.
Copy the brush files to a server.
Then paste the script code in your template. I use a html/javascript widget in the footer for this purpose.
<script language="javascript" src="http://path/to/your/server/shCore.js"></script>
<script language="javascript" src="http://path/to/your/server/shBrushCss.js"></script>
<script language="javascript" src="http://path/to/your/server/shBrushXml.js"></script>
<script language="javascript">
dp.SyntaxHighlighter.ClipboardSwf = 'http://path/to/your/server/clipboard.swf';
dp.SyntaxHighlighter.BloggerMode();
dp.SyntaxHighlighter.HighlightAll('code');
</script>
Finaly link to the stylesheet, place this before the </head> tag in the template.
<link type="text/css" rel="stylesheet" href="http://path/to/your/server/SyntaxHighlighter.css"></link>
If you switch to blogger in draft then you don't need the BloggerMode.
usage
<pre name='code' class='lang'>
code snippet...
</pre>
Choose lang from the aliases in the table, you also need to load the corresponding brush.
Language | Aliases |
C++ | cpp, c, c++ |
C# | c#, c-sharp, csharp |
CSS | css |
Delphi | delphi, pascal |
Java | java |
Java Script | js, jscript, javascript |
PHP | php |
Python | py, python |
Ruby | rb, ruby, rails, ror |
Sql | sql |
VB | vb, vb.net |
XML/HTML | xml, html, xhtml, xslt |
modifications
I had to remove the background for the li elements in the css file.
configuration
These options allow you to individually configure text blocks.
nogutter | Will display no gutter. |
nocontrols | Will display no controls at the top. |
collapse | Will collapse the block by default. |
firstline[value] | Will begin line count at value. Default value is 1. |
showcolumns | Will show row columns in the first line. |
The options are passed together with the alias and are separated by a colon : character.
Comments
Post a Comment