Friday, January 18, 2008

Code Syntax-Highlighting on Blogger

Any self-respecting coder will not blog about programming without proper code syntax-highlighting. If you use Blogger, I'll save you the trouble of googling... Good results here and here.

As mentioned in the above blog links, I too am using TextMate on OS X which has a nifty built-in 'export to HTML' which, when combined with TextMate's themed CSS, gives very nice looking code blocks. You simply select the code you want highlighted, export it from TextMate, and paste into the HTML editor in Blogger.

I saved the TextMate CSS into my blogger template, so now any <pre> tag will produce a pretty code block, and any pasted HTML code from TextMate will be blocked and colorized.

Yet another (perhaps better) approach which also works quite well is a JavaScript project cleverly named syntaxhighlighter. I stumbled across this code when viewing which uses this library. The feature that I really liked is that it puts some nifty links at the top of each code block that allow copy to clipboard, and options to view the code in a separate window. The only downside is that because it is implemented with RegEx's in JavaScript, for large blocks of code, it will likely slow things down too much to be useful. But for short blocks of code, it is really a nice solution! Next time I post some code to this blog, I think I will give it a try!


Anonymous said...

It is necessary to note, nonetheless, that while utilizing a VPN doesn’t violate most playing sites’ Terms of Use, it may if you’re primarily inserting bets outdoors the nation in which you’ve established your account. Please train a fundamental stage of warning when utilizing a VPN in South Korea. 1xbet korea Nowadays, the playing trade generates over 40% of the GDP of Macau. Since the early 1960s, round 50% of Macau's official income has been pushed by playing. In 1998, 44.5% of total government income was produced by the direct tax on playing. Then there was a 9.1% decrease in 1999, in all probability end result of} web gaming.

Anonymous said...

If you see this happening, convey it to the gambler’s consideration and stand by them when they reach out for assist at treatment facilities or clinics. A drawback gambler can't 솔카지노 cease playing behavior regardless of the recognition of ever-increasing, severe adverse consequences. The casinos in Nevada and New Jersey are the obvious spots, but hardly the one locations to gamble. Native American casinos operate in 28 states with annual income of practically $30 billion.

slrrop07nv said...

As companies strive to provide probably the most glorious merchandise attainable, CNC machines will only get better with time. Competitive companies that supply CNC companies are constantly working on tightening their tolerances and high quality management systems. They are offering to best stainless steel teapot provide orders of any amount, utilizing a wide range|a variety} of supplies choice, at affordable prices with the highest high quality attainable. 3-axis CNC machining works by eradicating material from the principle object utilizing slicing tools at excessive velocity. It’s a much less versatile methodology used with CNC milling and turning strategies. With 3-axis, you can to|you possibly can} produce commonly used merchandise and shapes with out a lot expertise within the subject.