Forum: Radiant CMS best code syntax highlighting solution

D24f9cba71237accf4281ed2a9fc3fd2?d=identicon&s=25 Craayzie As a fox (craayzie)
on 2010-12-08 08:40
(Received via mailing list)
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 :P

I found http://alexgorbatchev.com/SyntaxHighlighter/ 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
Efc9d9d149b91368c764d4eaee4c58ca?d=identicon&s=25 John Muhl (johnmuhl)
on 2010-12-08 16:03
(Received via mailing list)
On Wed, Dec 8, 2010 at 1:39 AM, craayzie <fleshins@gmail.com> 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.
D24f9cba71237accf4281ed2a9fc3fd2?d=identicon&s=25 Craayzie As a fox (craayzie)
on 2010-12-08 19:38
(Received via mailing list)
Thanks John - will take a look. Do you have any public pages you can
share
as examples?
Efc9d9d149b91368c764d4eaee4c58ca?d=identicon&s=25 John Muhl (johnmuhl)
on 2010-12-08 21:50
(Received via mailing list)
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.
D24f9cba71237accf4281ed2a9fc3fd2?d=identicon&s=25 Craayzie As a fox (craayzie)
on 2010-12-12 23:51
(Received via mailing list)
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.
D24f9cba71237accf4281ed2a9fc3fd2?d=identicon&s=25 Craayzie As a fox (craayzie)
on 2010-12-12 23:59
(Received via mailing list)
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? :P

Thanks again.
D24f9cba71237accf4281ed2a9fc3fd2?d=identicon&s=25 Craayzie As a fox (craayzie)
on 2010-12-13 00:07
(Received via mailing list)
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 :)
http://ext.radiantcms.org/extensions/192-kramdown-filter

now just need to figure out how to leverage the coderay gem :P
D24f9cba71237accf4281ed2a9fc3fd2?d=identicon&s=25 Craayzie As a fox (craayzie)
on 2010-12-13 00:24
(Received via mailing list)
So looks like there are two radiant extensions below that allow you to
leverage the coderay gem:
https://github.com/phallstrom/code_ray
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?

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

Thanks!
Efc9d9d149b91368c764d4eaee4c58ca?d=identicon&s=25 John Muhl (johnmuhl)
on 2010-12-13 04:28
(Received via mailing list)
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.
2b64274a52355e39ff9fe937cb117a64?d=identicon&s=25 Kevin Triplett (mopacmedia)
on 2010-12-13 08:17
John Doe wrote in post #967984:
> So looks like there are two radiant extensions below that allow you to
> leverage the coderay gem:
> https://github.com/phallstrom/code_ray
> 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
D24f9cba71237accf4281ed2a9fc3fd2?d=identicon&s=25 Craayzie As a fox (craayzie)
on 2010-12-13 15:57
(Received via mailing list)
Looks like coderay is working well. I installed:

coderay gem + radiant extension @ https://github.com/phallstrom/code_ray

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
Efc9d9d149b91368c764d4eaee4c58ca?d=identicon&s=25 John Muhl (johnmuhl)
on 2010-12-13 16:02
(Received via mailing list)
On Mon, Dec 13, 2010 at 8:56 AM, Fima Leshinsky <fleshins@gmail.com>
wrote:
> Looks like coderay is working well. I installed:
> coderay gem + radiant extension @ https://github.com/phallstrom/code_ray
> 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.
This topic is locked and can not be replied to.