summaryrefslogtreecommitdiff
path: root/lib/banzai
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2017-10-03 23:03:36 +0800
committerLin Jen-Shin <godfat@godfat.org>2017-10-03 23:03:36 +0800
commit9e42df3cd18b437160ba4159a0f9e19f8540756d (patch)
tree6d1a9f2ffbf4ac3427f0ed56f946816af9243819 /lib/banzai
parente9ffa3395127618add901b9fc16117fb88c26b21 (diff)
parent2828b7688f95af7510afc049b65c8508b2065958 (diff)
downloadgitlab-ce-9e42df3cd18b437160ba4159a0f9e19f8540756d.tar.gz
Merge remote-tracking branch 'upstream/master' into gem/sm/bump-google-api-client-gem-from-0-8-6-to-0-13-6
* upstream/master: (186 commits) Resolve "Precompiled assets with digest strings are ignored in CI" Fix navigation dropdown close animation on mobile screens Add (partial) index on Labels.template Add grpc.log for Gitaly Fix gitaly-proto version in Gemfile.lock refactor issues_controller_spec `update` action Remove edit action for issues Add documentation to summarise project archiving Fix for Gitaly nil encoding issue Fix broken certificate-authority-data with kubectl >= 1.8.0 Improve performance of filtering notes in NotesController Bump gitaly-proto version to v0.39.0 Fix specs for project creation and update services Add CHANGELOG Doesn't check if path exists on disk when renaming a hashed project [ci skip] Fix archive spec descrptions Only copy old/new code when selecting left/right side of parallel diff Fix gitlab-rake gitlab:import:repos task Send extra Gitaly params for `send_git_archive` if needed Update GitLab Pages to v0.6.0 ...
Diffstat (limited to 'lib/banzai')
-rw-r--r--lib/banzai/filter/markdown_filter.rb32
1 files changed, 14 insertions, 18 deletions
diff --git a/lib/banzai/filter/markdown_filter.rb b/lib/banzai/filter/markdown_filter.rb
index ee73fa91589..9cac303e645 100644
--- a/lib/banzai/filter/markdown_filter.rb
+++ b/lib/banzai/filter/markdown_filter.rb
@@ -1,6 +1,18 @@
module Banzai
module Filter
class MarkdownFilter < HTML::Pipeline::TextFilter
+ # 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
+
def initialize(text, context = nil, result = nil)
super text, context, result
@text = @text.delete "\r"
@@ -13,27 +25,11 @@ module Banzai
end
def self.renderer
- @renderer ||= begin
+ Thread.current[:banzai_markdown_renderer] ||= begin
renderer = Banzai::Renderer::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
-
- private_class_method :redcarpet_options
end
end
end