Merge pull request #2970 from AndrewKvalheim/safe_links_only
Correct use of Redcarpet’s `safe_links_only` flag
This commit is contained in:
commit
85cae7d093
3 changed files with 12 additions and 9 deletions
|
|
@ -190,15 +190,18 @@ module FormatHelper
|
|||
def markdown(text, escape_html=true)
|
||||
return '' if text.nil?
|
||||
|
||||
options = {
|
||||
markdown_options = {
|
||||
autolink: true,
|
||||
space_after_headers: true,
|
||||
no_intra_emphasis: true,
|
||||
fenced_code_blocks: true,
|
||||
disable_indented_code_blocks: true,
|
||||
safe_links_only: true
|
||||
disable_indented_code_blocks: true
|
||||
}
|
||||
markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML.new(escape_html: escape_html), options)
|
||||
render_options = {
|
||||
escape_html: escape_html,
|
||||
safe_links_only: true
|
||||
}
|
||||
markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML.new(render_options), markdown_options)
|
||||
sanitize(markdown.render(text))
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue