Back to the extension listing.
Webgen::Tag::Coderay
Summary
The following tag names are registered for this tag class: coderay
This tag uses the following options:
tag.coderay.lang(mandatory default)tag.coderay.process_bodytag.coderay.wraptag.coderay.line_numberstag.coderay.line_number_starttag.coderay.bold_everytag.coderay.tab_widthtag.coderay.css
Description
This tag applies syntax highlighting to its body by using the coderay library which can be used
to highlight many different languages (see tag.coderay.lang documentation). The body of the tag
specifies what should be highlighted.
By using the configuration option tag.coderay.css you can specify whether you want to have inline
styles, the default external stylesheet file or your own stylesheet file.
It is easy to include and highlight an entire file by combining this tag with the
include_filetag:{coderay:: ruby}{include_file: test.rb}{coderay}
This extension is only available if you have installed the coderay library. The preferred way to do this is via Rubygems:
gem install coderay
Examples
| Usage | Output |
|---|---|
| {coderay:: {lang: ruby, bold_every: 2}}{include_file: lib/webgen/version.rb}{coderay} | 1 # -*- encoding: utf-8 -*- 2 3 module Webgen 4 5 # The version of webgen. 6 VERSION = '0.5.14' 7 8 end |
| {coderay:: {lang: ruby, wrap: span, css: class}}puts 5+5{coderay} | 1 puts 5+5 |
Back to the extension listing.