Module: How::SyntaxHighlighter

Defined in:
lib/how/syntax_highlighter.rb

Overview

This module contains methods to handle syntax highlighting.

Class Method Summary collapse

Class Method Details

.get_pygments_lexer(syntax) ⇒ String?

Retrieves the Pygments lexer corresponding to the supplied syntax type.

Parameters:

  • syntax (String)

    The type of syntax

Returns:

  • (String, nil)

See Also:



9
10
11
12
13
14
15
16
# File 'lib/how/syntax_highlighter.rb', line 9

def self.get_pygments_lexer(syntax)
  case syntax.downcase
  when 'rb', 'ruby'
    'rb'
  when 'js', 'javascript'
    'js'
  end
end