# Syntax Highlighting

**URL:** <https://www.ruby-forum.com/t/syntax-highlighting/143135>\
**Category:** Radiant CMS\
**Created:** [July 15, 2008, 3:51pm UTC](https://www.ruby-forum.com/t/syntax-highlighting/143135 "2008-07-15T15:51:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![joshs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e5b9ba/32.png) [@joshs](https://www.ruby-forum.com/u/joshs)\
**Post date:** [July 15, 2008, 3:51pm UTC](https://www.ruby-forum.com/t/syntax-highlighting/143135/1 "2008-07-15T15:51:49Z")

</div>

Is anyone using the syntax\_highlighting extension?  
[http://github.com/marcoow/syntax\_highlighting/tree/master](http://github.com/marcoow/syntax_highlighting/tree/master)

It seems to be doing the parsing, but when it renders in a page, it’s  
strictly as “code” html, so all the tags that input as part of  
it are rendered as well.

For example,

\<r:code language=“python”\>  
import pygments  
foo = “bar”  
\</r:code\>

renders as:

import pygmentsfoo = “bar”\</  
span\>

Any ideas? There is currently no filter set on the page, and if I set  
it to “textile” all the \< & \> get turned to \< & \>, respectively.

Is there another option for syntax highlighting? I would like to have  
more languages than code\_ray currently supports.

---

<div class="post-metadata">

**Author:** ![joshs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e5b9ba/32.png) [@joshs](https://www.ruby-forum.com/u/joshs)\
**Post date:** [July 15, 2008, 4:02pm UTC](https://www.ruby-forum.com/t/syntax-highlighting/143135/2 "2008-07-15T16:02:23Z")

</div>

It’s not perfect, but I like using Dan W.'s Syntax Highlighter  
(JavaScript). Just put your source code inside ` tags with the
class of the language you want, like so:`

`
puts “Hello, World!”
You can download it at http://danwebb.net.
Sean`

---

<div class="post-metadata">

**Author:** ![joshs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e5b9ba/32.png) [@joshs](https://www.ruby-forum.com/u/joshs)\
**Post date:** [July 15, 2008, 4:34pm UTC](https://www.ruby-forum.com/t/syntax-highlighting/143135/3 "2008-07-15T16:34:03Z")

</div>

Josh,

No, but you can steal my CSS styles:  
[http://seancribbs.com/stylesheets/code.css](http://seancribbs.com/stylesheets/code.css)

Sean

---

<div class="post-metadata">

**Author:** ![joshs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e5b9ba/32.png) [@joshs](https://www.ruby-forum.com/u/joshs)\
**Post date:** [July 15, 2008, 4:22pm UTC](https://www.ruby-forum.com/t/syntax-highlighting/143135/4 "2008-07-15T16:22:20Z")

</div>

Sean,

That’s sharp. I love the fact that it’s unobtrusive and seems much  
more accessible for customization than some of the others. Thanks for  
pointing it out. Have you written a regex for anything?

Regards,  
Josh
