iprog.com

Moving to Markdown

In the past I’ve used Textile markup for this blog, processed by the RedCloth gem. It has done (and continues to do) a good job.

However, it seems the trend is toward Markdown. GitHub, StackExchange, and others have all embraced it. A new project I’m working on will also be using Markdown.

It seemed like it was time to move to Markdown here on the blog too.

There are a number of gems capable of processing Markdown. However, one of the most extensive appears to be redcarpet. It has baked-in support for most of GFM (GitHub-flavored Markdown), which is a bonus.

Going forward, all posts will be rendered accordingly. As a bonus, GFM’s fenced-code-blocks are much cleaner than what I had hacked in previously, so there should be fewer weird-syntax-highlighting issues. I don’t plan on going back to cleanup the old posts though.

Oh, and comments now enjoy Markdown too! Yay!

As an aside, way back I discussed syntax highlighting in rails. My current gem of choice is coderay. Most of the options are just Ruby wrappers for the Python-based pygments. That’s a viable solution, but if you want to keep it Ruby-native, then coderay is a nice alternative.

0 comments

New and shiny site design

Once again it has become time to refresh the site design. Looking back, it appears the last site refresh was in July of 2007—I’m not sure if 5 years on the same design demonstrates longevity and consistency, or if it just means I’m horribly overdue.

Regardless, now everything is nice and shiny. One of the goals of the new design was to do my best to leverage HTML5 and CSS3, including new HTML5 tags and use of many of the newer CSS features. As a consequence, the only image file is the background. Everything else is CSS effects along with a couple CSS fonts.

I also used the refresh as an excuse to experiment with responsive design. I haven’t had a chance to test a wide array of small-screen devices yet, but on the ones I have access to (various iDevices), the site is usable. I’d love to hear your experience, good or bad, on any kind of smaller-screen device.

Other changes include numerous updates to the software stack (Rails 3.2, etc.), better syntax highlighting (now with line numbers!), and improved (in theory) spam filtering.

0 comments

syntax highlighting for rails

i’ve been rewriting the software backend for this site. it has been my intention, once that was partly done, to begin to discuss more technical stuff here, including code samples—most likely for rails stuff.

that’s all fine and well, but you can’t just post code snippets in black and white. no, this is a technicolor world now and that would never do. so i’ve been on a quest to figure how how to make my shiny, new rails backend parse the code blocks and introduce them to my box of 64 (!) crayolas. (as an aside, i’m pretty sure i wasn’t the only one at age 7 who thought his world would be complete if only i could get a 64-color crayola set — much better than my set of 16.)

anyway, i won’t get into lots of details at this point (although i can if somebody wants me to), but in case you need to do the same thing, here are a few jumping off points.

the most common solution seems to be to use the syntax gem. you’ll need to roll your own interface between it and rails, although rails weenie can offer some help.

syntax will recognize ruby, yaml, and xml by default. if you need something more robust, UltraViolet looks interesting although it would certainly have a heavier memory footprint. it leverages textmate bundles so it should be able to interpret/colorize nearly anything that is even semi-common, and then some.

i’m sure there are more options—add them to the comments if you know of something.

0 comments