class Redcarpet::Render::Safe
with the vanilla one.
the lang’s class as the user can basically specify anything
The block_code
callback is also overriden not to include
enables escape_html
and safe_links_only
by default.
A renderer object you can use to deal with users’ input. It
def block_code(code, lang)
def block_code(code, lang) "<pre>" \ "<code>#{html_escape(code)}</code>" \ "</pre>" end
def html_escape(string)
are duplicating existing code from Houdini. This method
TODO: This is far from ideal to have such method as we
def html_escape(string) string.gsub(/['&\"<>\/]/, { '&' => '&', '<' => '<', '>' => '>', '"' => '"', "'" => ''', "/" => '/', }) end
def initialize(extensions = {})
def initialize(extensions = {}) super({ escape_html: true, safe_links_only: true }.merge(extensions)) end