Class: HTMLwithSyntaxHighlighter
- Inherits:
-
Redcarpet::Render::XHTML
- Object
- Redcarpet::Render::XHTML
- HTMLwithSyntaxHighlighter
- Defined in:
- lib/mamemose.rb
Instance Method Summary collapse
Instance Method Details
#block_code(code, lang) ⇒ Object
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/mamemose.rb', line 25 def block_code(code, lang) highlight = defined?(SYNTAX_HIGHLIGHT) ? SYNTAX_HIGHLIGHT : :coderay lang ||= 'plain' if highlight == :syntaxhighlighter code = HTMLEntities.new.encode(code) "<pre class='brush: #{lang}'>#{code}</pre>" else CodeRay.scan(code, lang.to_sym).div(:line_numbers => :table) end end |