diff options
author | Robert Speicher <rspeicher@gmail.com> | 2015-08-31 23:22:34 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2015-08-31 23:22:34 +0300 |
commit | 08ca9411865a9dff5354f0e7ec214fba6af4e9d9 (patch) | |
tree | 8cf0615bf57fcfbaa8c760dfd245e22b4bb3c812 /lib/gitlab | |
parent | 805693bfea900ed656524abeeb7dd2fb06520123 (diff) |
Move REDCARPET_OPTIONS to a private method
There wasn't really a reason to have them as a constant, and we were
getting "already defined" warnings which are always annoying.
Diffstat (limited to 'lib/gitlab')
-rw-r--r-- | lib/gitlab/markdown.rb | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/lib/gitlab/markdown.rb b/lib/gitlab/markdown.rb index 7efcbaf3252..097caf67a65 100644 --- a/lib/gitlab/markdown.rb +++ b/lib/gitlab/markdown.rb @@ -5,18 +5,6 @@ module Gitlab # # See the files in `lib/gitlab/markdown/` for specific processing information. module Markdown - # https://github.com/vmg/redcarpet#and-its-like-really-simple-to-use - REDCARPET_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 - # Convert a Markdown String into an HTML-safe String of HTML # # markdown - Markdown String @@ -40,7 +28,7 @@ module Gitlab # # Returns a String def self.render_without_gfm(markdown) - self.renderer.render(markdown) + renderer.render(markdown) end # Provide autoload paths for filters to prevent a circular dependency error @@ -123,10 +111,24 @@ module Gitlab def self.renderer @markdown ||= begin renderer = Redcarpet::Render::HTML.new - Redcarpet::Markdown.new(renderer, REDCARPET_OPTIONS) + Redcarpet::Markdown.new(renderer, redcarpet_options) end end + def self.redcarpet_options + # https://github.com/vmg/redcarpet#and-its-like-really-simple-to-use + @redcarpet_options ||= { + fenced_code_blocks: true, + footnotes: true, + lax_spacing: true, + no_intra_emphasis: true, + space_after_headers: true, + strikethrough: true, + superscript: true, + tables: true + }.freeze + end + # Filters used in our pipeline # # SanitizationFilter should come first so that all generated reference HTML |