I have the following function in application_helper.rb:
def markdown(text)
options = {}
renderer = CustomRender.new(hard_wrap: true, filter_html: true)
Redcarpet::Markdown.new(renderer, options).render(text).html_safe
end
I am using a custom renderer. I am confused as to why I can use bulleted lists, italicized text, codespans, etc. I do not have them enabled in my render options.
I thought maybe I could just turn them off:
options = {
codespan: false,
}
However, codespans are still recognized by redcarpet, and styling is applied. How can I turn off all tags from markdown and only enable a select few?
Define method for codespan in your CustomRenderer
Now you can see no
<code>tag is added when calling markdownYou can overwrite all the methods mentioned here https://github.com/vmg/redcarpet#block-level-calls