- Download SyntaxHighlighter
-
Create/Use a google pages account to upload the following files
- SyntaxHighlighter.css
- clipboard.swf
- shCore.js
- shBrushCss.js
- shBrushJava.js
- shBrushJScript.js
- shBrushSql.js
- shBrushXml.js
-
Inside of the <head> tag, link to those files
<link type="text/css" rel="stylesheet" href="http://you.googlepages.com/SyntaxHighlighter.css" /> <script type="text/javascript" src="http://you.googlepages.com/shCore.js"></script> <script type="text/javascript" src="http://you.googlepages.com/shBrushCss.js"></script> <script type="text/javascript" src="http://you.googlepages.com/shBrushJava.js"></script> <script type="text/javascript" src="http://you.googlepages.com/shBrushJScript.js"></script> <script type="text/javascript" src="http://you.googlepages.com/shBrushSql.js"></script> <script type="text/javascript" src="http://you.googlepages.com/shBrushXml.js"></script>and this javascriptdp.SyntaxHighlighter.ClipboardSwf = "http://you.googlepages.com/clipboard.swf"; dp.SyntaxHighlighter.BloggerMode(); dp.SyntaxHighlighter.HighlightAll("code"); -
Place your code on the page and surround it with <pre> tag. Set name attribute to code and class attribute to one of the language aliases you wish to use.
<pre><textarea name="code" class="xhtml" cols="60" rows="1"> ... some code here ... </textarea></pre> <pre name="code" class="xhtml"> ... some code here ... </pre> <pre class="xhtml" title="code"> ... some code here ... </pre>If done my way using the title attribute instead of name, also add this bit of jquery in the <head> tag (or any other sort of javascript that will add the name attribute to the <pre> tag).$("pre[title=code]").attr("name", "code"); - On your blogger blog, turn off the "Convert Line Breaks" option in Admin > Formatting. If this is not turned off, all of your code will show up on one line. I prefer to have this turned off by default anyways.
1.18.2009
How to Implement Syntax Highlighter on Blogger
1.09.2009
How to Find and Fix IE6 Double Margin Bug Using jQuery Custom Selectors
I ran into the ie6 double margin bug and I decided that I wanted to be able to find these bugs (and fix them) with jQuery. I could just have fixed the bug using this solution, but I wanted to create a way to fix it if I bypass an error of this sort and also log it.
In order to create a fix, I had to find out if the selected element was floating and did not have a display of inline.
When I finished writing that code, I wondered if things could be a heck of a lot easier if I could just use a couple custom jQuery selectors to find elements that might need fixing. Therefore, I made a couple custom selectors to make this process easier.
I don't really need the marginy and margin selectors, but I figured that I should just create them because the belong with the marginx selector. Now, all that is needed to find and fix an element that falls victim to this bug is the following.
This could also be used to find bugs so that you can fix them in your css.
How to Use sIFR with jQuery to Use Your Own Fonts
Scalable Inman Flash Replacement (sIFR) allows you to use custom typography on your site by using JavaScript, Flash, and CSS. With the jQuery Sifr Plugin, you can easily display dynamic, on-the-fly text using the font(s) of their choice, regardless of the visitor's currently installed fonts, web browser, or operating system. This plugin provides a very simple configuration process.
Step 1: Download jQuery
Step 2: Download the jQuery sIFR Plugin
Step 3: Include this code in the head tag of your page
Here are some examples of the jQuery sIFR Plugin in use.
