Syntax Highlighting
Many hackers of Oz like to share syntax highlighted code snippets via their blog. Perhaps toto could leverage Maker's Mark (or something similar) to add this ability to markdown?
http://github.com/nakajima/makers-mark
This is definitely something I'd like to have — I've been looking into javascript solutions though, such as the google syntax highlighter.
Maker's Mark looks pretty cool though, I'll look into it.
Is there a reason to include this as part of toto rather than leaving it up to the user to decide what highlighting script they'd like to use? I think it should be a "bring your own" solution :)
If toto gets its own baked-in syntax highlighting that'd be awesome, but I'm fine with using embedded gists in the meantime. Something that works like Maker's Mark but is ruby-only and rack-friendly would be nice.
Yah, looks like Maker's Mark is not the best solution since it relies on Pygments to do the actual work. I didn't realize that before.
This looks like a job for a client-side library. Highlight.js seems to play nice with Markdown so I'm going to give it a try.
http://softwaremaniacs.org/soft/highlight/en/
There's also http://ultraviolence.heroku.com, by technoweenie
Wow, http://softwaremaniacs.org/soft/highlight/en/ is amazing. I especially like how it doesn't pollute our articles or config.ru or introduce gem dependencies and so on: it's just some js and css, requiring only a few lines in layout.rhtml. Minimal fuss. Nice find sant0sk1!
Looks real good. The other alternative is: http://code.google.com/p/syntaxhighlighter/
I'm probably going to add one of these to dorothy, it'll be to the user's discretion whether or not they include it in their html.
I'm using Rack-codehighlighter with ultraviolet. It was only a few llines in config.ru
The rack-codehighlighter + ultraviolet combination produces very nice results. I've forked the dormant ultraviolet in the interest of adding vibrant_ink for myself, pushed a gem and it worked out wonderfully.
I did encounter one problem. rack-codehighlighter uses hpricot, and hpricot couldn't parse the html 5 markup. I just ended up switching to old school html.
@vertiginous Nice catch. I've switched rack-codehighlighter from hpricot to nokogiri and pushed a gem to hold us over until it is accepted upstream. It WorksForMe and YMMV.
http://wiki.github.com/cloudhead/toto/syntax-highlighting
Made a wiki page, everyone, update it!
What would be awesome would be to have support for Pygments via albino: https://github.com/github/albino
I believe that server side solution is robust, but it looks improper for me. Why we need to highlight code on server side? It's not the part of the content in fact. So propose to use JavaScript based client side syntax highlighters like Hoghlight.JS of Ivan Sgalaev or Syntaxhighlighter of Alex Gorbatchev. Personally I use Ivan's version, you can take a look how I use it here: https://github.com/ixti/blog