Class: GHI::Formatting::Colors::Pygmentizer
- Inherits:
-
Object
- Object
- GHI::Formatting::Colors::Pygmentizer
- Defined in:
- lib/ghi/formatting/colors.rb
Instance Method Summary collapse
- #highlight(code_block) ⇒ Object
-
#initialize ⇒ Pygmentizer
constructor
A new instance of Pygmentizer.
Constructor Details
#initialize ⇒ Pygmentizer
Returns a new instance of Pygmentizer.
324 325 326 |
# File 'lib/ghi/formatting/colors.rb', line 324 def initialize @style = GHI.config('ghi.highlight.style') || 'monokai' end |
Instance Method Details
#highlight(code_block) ⇒ Object
328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 |
# File 'lib/ghi/formatting/colors.rb', line 328 def highlight(code_block) begin indent = code_block['indent'] lang = code_block['lang'] code = code_block['code'] if lang != "" output = pygmentize(lang, code) else output = code end with_indentation(output, indent) rescue code_block end end |