Summary | Applies syntax highlighting to the tag body |
---|---|
Tag names | coderay |
Configuration prefix | tag.coderay |
Mandatory options |
tag.coderay.lang |
Used options |
tag.coderay.lang tag.coderay.process_body tag.coderay.wrap tag.coderay.line_numbers tag.coderay.line_number_start tag.coderay.bold_every tag.coderay.tab_width tag.coderay.css |
Provided by bundle | built-in |
API doc | Webgen::Tag::Coderay |
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).
This extension is only available if the coderay library is installed. The preferred way to do this is via Rubygems:
$ gem install coderay
Usage
This tag needs a tag body because the body contains the text that should be syntax highlighted. Using the available configuration options allows one to customize the output. Note that the tag.coderay.lang option is mandatory and needs to be specified for every tag!
It is easy to include and highlight an entire file by combining this tag with the tag include_file:
{coderay:: ruby}{include_file: test.rb}{coderay}
Examples
{coderay:: {lang: yaml, bold_every: 2}}{include_file: {filename: webgen.config, process_output: false}}{coderay}
1content_processor: 2 kramdown.options: 3 :coderay_line_numbers: ~ 4 erb.trim_mode: '%' 5 6content_processor.tikz: 7 transparent: true 8 resolution: 288 96 9 10website.base_url: http://webgen.gettalong.org 11 12node_finder.option_sets: 13 auto_nav_links: 14 alcn: /documentation/**/*.en.html 15 sort: true 16 not: 17 alcn: 18 - /documentation/reference/api/**/*.en.html 19 - /documentation/**/index.en.html 20 - /documentation/reference/extensions/content_processor.en.html 21 - /documentation/reference/extensions/path_handler.en.html 22 - /documentation/reference/extensions/source.en.html 23 - /documentation/reference/extensions/tag.en.html 24 - /documentation/reference/extensions/destination.en.html 25 - /documentation/reference/extensions/item_tracker.en.html
{coderay:: {lang: ruby, wrap: span, css: class}}puts 5+5{coderay}
- 1puts 5+5