Module | Webby::Helpers::CodeRayHelper |
In: |
lib/webby/helpers/coderay_helper.rb
|
The coderay method applies syntax highlighting to source code embedded in a webpage. The CodeRay highlighting engine is used for the HTML markup of the source code. The page sections to be highlighted are given as blocks of text to the coderay method.
Options can be passed to the CodeRay engine via attributes in the coderay method.
<% coderay( :lang => "ruby", :line_numbers => "inline" ) do -%> # Initializer for the class. def initialize( string ) @str = stirng end <% end -%>
The supported CodeRay options are the following:
:lang : the language to highlight (ruby, c, html, ...) :line_numbers : include line numbers in 'table', 'inline', or 'list' :line_number_start : where to start with line number counting :bold_every : make every n-th number appear bold :tab_width : convert tab characters to n spaces