Class: Redcarpet::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.
32 33 34 35 36 37 |
# File 'lib/redcarpet.rb', line 32 def initialize(extensions = {}) super({ escape_html: true, safe_links_only: true }.merge(extensions)) end |
Instance Method Details
#block_code(code, lang) ⇒ Object
39 40 41 42 43 |
# File 'lib/redcarpet.rb', line 39 def block_code(code, lang) "<pre>" \ "<code>#{html_escape(code)}</code>" \ "</pre>" end |