diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-06-02 13:17:11 +0200 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-06-02 13:17:11 +0200 |
commit | fe78984f2045a79554ae52478d01d9102c6b6a77 (patch) | |
tree | 38ed64880315781bcf0f3bd1e1372114201c3714 /app/helpers | |
parent | 5a1aa49b5533593dc4c6de82279fe44f5f15616c (diff) | |
download | gitlab-ce-fe78984f2045a79554ae52478d01d9102c6b6a77.tar.gz |
Actually ignore references in code blocks etc.
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/gitlab_markdown_helper.rb | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/app/helpers/gitlab_markdown_helper.rb b/app/helpers/gitlab_markdown_helper.rb index 3c207619adf..2777944fc9d 100644 --- a/app/helpers/gitlab_markdown_helper.rb +++ b/app/helpers/gitlab_markdown_helper.rb @@ -41,29 +41,26 @@ module GitlabMarkdownHelper fragment.to_html.html_safe end + MARKDOWN_OPTIONS = { + no_intra_emphasis: true, + tables: true, + fenced_code_blocks: true, + strikethrough: true, + lax_spacing: true, + space_after_headers: true, + superscript: true, + footnotes: true + }.freeze + def markdown(text, options={}) unless @markdown && options == @options @options = options - options.merge!( - # Handled further down the line by Gitlab::Markdown::SanitizationFilter - escape_html: false - ) - # see https://github.com/vmg/redcarpet#darling-i-packed-you-a-couple-renderers-for-lunch rend = Redcarpet::Render::GitlabHTML.new(self, user_color_scheme_class, options) # see https://github.com/vmg/redcarpet#and-its-like-really-simple-to-use - @markdown = Redcarpet::Markdown.new(rend, - no_intra_emphasis: true, - tables: true, - fenced_code_blocks: true, - strikethrough: true, - lax_spacing: true, - space_after_headers: true, - superscript: true, - footnotes: true - ) + @markdown = Redcarpet::Markdown.new(rend, MARKDOWN_OPTIONS) end @markdown.render(text).html_safe |