Class: Greenmat::Render::Safe
Overview
A renderer object you can use to deal with users' input. It enables escape_html
and safe_links_only
by default.
The block_code
callback is also overriden not to include the lang's class as the user can basically specify anything with the vanilla one.
Instance Method Summary collapse
- #block_code(code, lang) ⇒ Object
-
#initialize(extensions = {}) ⇒ Safe
constructor
A new instance of Safe.
Constructor Details
#initialize(extensions = {}) ⇒ Safe
Returns a new instance of Safe.
31 32 33 34 35 36 |
# File 'lib/greenmat.rb', line 31 def initialize(extensions = {}) super({ escape_html: true, safe_links_only: true }.merge(extensions)) end |
Instance Method Details
#block_code(code, lang) ⇒ Object
38 39 40 41 42 |
# File 'lib/greenmat.rb', line 38 def block_code(code, lang) "<pre>" \ "<code>#{html_escape(code)}</code>" \ "</pre>" end |