Best code syntax highlighting solution

I’ve begun to explore Radiant as a publishing/blogging platform. At
the moment, I’m trying to nail down is how to best format command-line
output or code as the majority of the content published will be of a
technical nature.

Can someone point me in the right direction of what I should use to
get the “desired” affect :stuck_out_tongue:

I found Background Photos 100% For Free to Download | Wallpapers.com which is a
JavaScript-based solution. Unfortunately it doesn’t appear to support
formatting/highlighting command-line output.

What’s the best Radiant filter / JS library / some-other-solution out
there for both command-line output and code syntax highlighting?

Thanks in advance!

Fima

On Wed, Dec 8, 2010 at 1:39 AM, craayzie [email protected] wrote:

formatting/highlighting command-line output.

What’s the best Radiant filter / JS library / some-other-solution out
there for both command-line output and code syntax highlighting?

i like kramdown + coderay.

Thanks John - will take a look. Do you have any public pages you can
share
as examples?

http://johnmuhl.com/tmp/kramdown-coderay

the kramdown looks like (replace - with space):

----def meth options
------p options
----end
{:lang=“ruby”}

just a standard markdown code block followed by {:lang=“lang”}

http://coderay.rubychan.de/ list the supported languages.

Ok, so I’m sure you can tell by this last post of mine that I’m a
complete noob. Looks like it’s kramdown that I would use for the
markdown and then coderay for syntax highlighting. Fine. Figured out
that part. So now the question is how do I use kramdown + coderay w/
radiant? :stuck_out_tongue:

Thanks again.

don’t mind me - I’m just going to update this thread as I figure more
things
out … looks like there’s a kramdown radiant filter :slight_smile:
http://ext.radiantcms.org/extensions/192-kramdown-filter

now just need to figure out how to leverage the coderay gem :stuck_out_tongue:

I can’t quite figure out how to use the coderay gem. Could you provide
some guidance around how to do it? I see that there are filters
available to me via extensions that allow me to leverage different
text markups - I’m guessing I’d have to use the coderay gem in a
different manner? Or should it be exposed as a filter like the others?

Thanks for the help.

So looks like there are two radiant extensions below that allow you to
leverage the coderay gem:
https://github.com/phallstrom/code_ray

I’m inclined to use the the 2nd one since it supports other syntax
highlighters beyond coderay. What are your thoughts on which one to use?

Also, I’m curious, why use kramdown over the existing Markdown radiant
filter? Speed or other reasons as well?

Thanks!

John D. wrote in post #967984:

So looks like there are two radiant extensions below that allow you to
leverage the coderay gem:
GitHub - phallstrom/code_ray: A RadiantCMS extension to provide syntax highlighting via the CodeRay ruby gem
https://github.com/alno/radiant-code-extension

I’m inclined to use the the 2nd one since it supports other syntax
highlighters beyond coderay. What are your thoughts on which one to use?

I tried to use alno/radiant-code-extension for the same reason but had
to switch over to phallstrom/code_ray because I couldn’t overcome an
processor error and I decided that coderay was an acceptably easy
library to implement and use.

Ultimately, I forked it so I could merge envygeek’s fork and
pallstrom’s.

Kevin

Looks like coderay is working well. I installed:

coderay gem + radiant extension @ GitHub - phallstrom/code_ray: A RadiantCMS extension to provide syntax highlighting via the CodeRay ruby gem

and now I can specify <r:code> blocks!

not sure what the benefits are of kramdown over the existing Markdown
radiant filter that comes with the “Coffee blog” template. If you guys
can
shed some light on why kramdown is a better option I’d appreciate it.

Thanks again!
Fima

gem install radiant-kramdown_filter-extension
gem install coderay

then in config/environment.rb


require ‘radius’
require ‘coderay’ # add this line

config.gem ‘will_paginate’, :version => ‘~> 2.3.11’
config.gem ‘radiant-kramdown_filter-extension’ # add this line

then restart radiant and you should be all set.

On Mon, Dec 13, 2010 at 8:56 AM, Fima L. [email protected]
wrote:

Looks like coderay is working well. I installed:
coderay gem + radiant extension @ GitHub - phallstrom/code_ray: A RadiantCMS extension to provide syntax highlighting via the CodeRay ruby gem
and now I can specify <r:code> blocks!
not sure what the benefits are of kramdown over the existing Markdown
radiant filter that comes with the “Coffee blog” template. If you guys can
shed some light on why kramdown is a better option I’d appreciate it.

it’s not better. it’s the same but with kramdown specific options
enabled.