Class: Spirit::Render::Processors::PygmentsProcessor

Inherits:
Base
  • Object
show all
Defined in:
lib/spirit/render/processors/pygments_processor.rb

Instance Method Summary collapse

Methods inherited from Base

events, inherited, #initialize, #invoke_callbacks_for, process

Constructor Details

This class inherits a constructor from Spirit::Render::Processors::Base

Instance Method Details

#highlight_code(code, marker) ⇒ String

Pygmentizes code blocks.

Parameters:

  • code (String)

    code block contents

  • marker (String)

    name of language

Returns:

  • (String)

    highlighted code



14
15
16
# File 'lib/spirit/render/processors/pygments_processor.rb', line 14

def highlight_code(code, marker)
  Pygments.highlight(code, lexer: marker || 'text')
end