Class: Retter::Markdown::PygmentsRenderer
- Inherits:
-
Redcarpet::Render::HTML
- Object
- Redcarpet::Render::HTML
- Retter::Markdown::PygmentsRenderer
- Defined in:
- lib/retter/markdown/pygments_renderer.rb
Constant Summary collapse
- LANGUAGES =
Set.new(Pygments.lexers.map {|_, l| l[:aliases] }.flatten)
Instance Method Summary collapse
Instance Method Details
#block_code(code, lang) ⇒ Object
9 10 11 12 13 |
# File 'lib/retter/markdown/pygments_renderer.rb', line 9 def block_code(code, lang) lang = LANGUAGES.include?(lang) ? lang : 'text' Pygments.highlight(code, lexer: lang, formatter: 'html', options: {encoding: 'utf-8'}) end |