Commit 08ca9411 authored by Robert Speicher's avatar Robert Speicher

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.
parent 805693bf
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment