Method: Leg::Template::Context#syntax_highlighting_css

Defined in:
lib/leg/template.rb

#syntax_highlighting_css(scope) ⇒ Object



81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/leg/template.rb', line 81

def syntax_highlighting_css(scope)
  syntax_theme = @config.options[:syntax_theme] || "github"
  if syntax_theme.is_a? String
    theme = Rouge::Theme.find(syntax_theme)
  elsif syntax_theme.is_a? Hash
    theme = Class.new(Rouge::Themes::Base16)
    theme.name "base16.custom"
    theme.palette syntax_theme
  end

  theme.render(scope: scope)
end