Class: PageHub::Markdown::HTMLWithAlbino
- Inherits:
-
Redcarpet::Render::HTML
- Object
- Redcarpet::Render::HTML
- PageHub::Markdown::HTMLWithAlbino
- Defined in:
- lib/pagehub-markdown/markdown.rb
Overview
a renderer that uses Albino to highlight syntax
Instance Method Summary collapse
Instance Method Details
#block_code(code, language) ⇒ Object
112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/pagehub-markdown/markdown.rb', line 112 def block_code(code, language) begin # TODO: try to figure out whether @language is valid out = Albino.colorize(code, language) rescue Exception => e out = "" # return "-- INVALID CODE BLOCK, MAKE SURE YOU'VE SURROUNDED CODE WITH ```" end # just render the code as plain text if the language is invalid out.empty? ? block_code(code, "text") : out end |