summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dzaporozhets@gitlab.com>2015-04-10 12:39:11 +0000
committerDmitriy Zaporozhets <dzaporozhets@gitlab.com>2015-04-10 12:39:11 +0000
commit256d2ae7001f7f84835a34d2f2e727eefcbe0c72 (patch)
tree51f4d8874301efeb55d93a430c68c8d879c0e81d
parent6848312f3758dd895310b8367079dfd8a45903a2 (diff)
parent5a0ff2f52f3fbfa32b09e342552f03f851f4365b (diff)
downloadgitlab-ce-256d2ae7001f7f84835a34d2f2e727eefcbe0c72.tar.gz
Merge branch 'rs-issue-2211' into 'master'
Update redcarpet to 3.2.3 Closes #2211 See merge request !1756
-rw-r--r--Gemfile2
-rw-r--r--Gemfile.lock4
-rw-r--r--app/helpers/gitlab_markdown_helper.rb38
-rw-r--r--lib/gitlab/reference_extractor.rb2
4 files changed, 25 insertions, 21 deletions
diff --git a/Gemfile b/Gemfile
index cce1f47ef15..a3720ce17f8 100644
--- a/Gemfile
+++ b/Gemfile
@@ -94,7 +94,7 @@ gem 'html-pipeline-gitlab', '~> 0.1'
gem "github-markup"
# Required markup gems by github-markdown
-gem 'redcarpet', '~> 3.1.2'
+gem 'redcarpet', '~> 3.2.3'
gem 'RedCloth'
gem 'rdoc', '~>3.6'
gem 'org-ruby', '= 0.9.12'
diff --git a/Gemfile.lock b/Gemfile.lock
index d7a292d4e53..747dbe1b037 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -457,7 +457,7 @@ GEM
ffi (>= 0.5.0)
rdoc (3.12.2)
json (~> 1.4)
- redcarpet (3.1.2)
+ redcarpet (3.2.3)
redis (3.1.0)
redis-actionpack (4.0.0)
actionpack (~> 4)
@@ -755,7 +755,7 @@ DEPENDENCIES
rb-fsevent
rb-inotify
rdoc (~> 3.6)
- redcarpet (~> 3.1.2)
+ redcarpet (~> 3.2.3)
redis-rails
request_store
rspec-rails (= 2.99)
diff --git a/app/helpers/gitlab_markdown_helper.rb b/app/helpers/gitlab_markdown_helper.rb
index 7ca3f058636..17266656a4e 100644
--- a/app/helpers/gitlab_markdown_helper.rb
+++ b/app/helpers/gitlab_markdown_helper.rb
@@ -31,24 +31,28 @@ module GitlabMarkdownHelper
def markdown(text, options={})
unless @markdown && options == @options
@options = options
- gitlab_renderer = Redcarpet::Render::GitlabHTML.new(self,
- user_color_scheme_class,
- {
- # see https://github.com/vmg/redcarpet#darling-i-packed-you-a-couple-renderers-for-lunch-
- with_toc_data: true,
- safe_links_only: true
- }.merge(options))
- @markdown = Redcarpet::Markdown.new(gitlab_renderer,
- # see https://github.com/vmg/redcarpet#and-its-like-really-simple-to-use
- no_intra_emphasis: true,
- tables: true,
- fenced_code_blocks: true,
- autolink: true,
- strikethrough: true,
- lax_spacing: true,
- space_after_headers: true,
- superscript: true)
+
+ # 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, {
+ with_toc_data: true,
+ safe_links_only: true,
+ # Handled further down the line by HTML::Pipeline::SanitizationFilter
+ escape_html: false
+ }.merge(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,
+ autolink: true,
+ strikethrough: true,
+ lax_spacing: true,
+ space_after_headers: true,
+ superscript: true
+ )
end
+
@markdown.render(text).html_safe
end
diff --git a/lib/gitlab/reference_extractor.rb b/lib/gitlab/reference_extractor.rb
index 1058d4c43d9..c0419585c4b 100644
--- a/lib/gitlab/reference_extractor.rb
+++ b/lib/gitlab/reference_extractor.rb
@@ -3,7 +3,7 @@ module Gitlab
class ReferenceExtractor
attr_accessor :users, :labels, :issues, :merge_requests, :snippets, :commits, :commit_ranges
- include Markdown
+ include ::Gitlab::Markdown
def initialize
@users, @labels, @issues, @merge_requests, @snippets, @commits, @commit_ranges =