code_highlighter

Code syntax highlighter for ruby on rails

2
0
Ruby

Code Highlighter

This is a basic code syntax highlighter using Hpricot and XML.

Example Rails Usage

Add the associated programming language to the

tag class attribute

	
		<%= link_to 'Home', root_path %>
	

Basic code highlighting

<%= highlight_code(@article.article) %>

Textile code highlighting

<%= highlight_textile_code(@article.article) %>

Example CSS

pre {
background: #000;
padding: 0 15px;
color: #fff;
}

pre code p {
margin: 0 0 5px;
}

.symbol, .keyword {
color: yellow;
}

.string {
color: #61cb3a;
}

.entity, .selector {
color: #ff740e;
}

.comment {
color: #555;
font-style: italic;
}

Copyright © 2008 Brad Haydon, released under the MIT license