summaryrefslogtreecommitdiff
path: root/lib/banzai
diff options
context:
space:
mode:
authorBrett Walker <bwalker@gitlab.com>2018-09-08 04:21:30 +0000
committerStan Hu <stanhu@gmail.com>2018-09-08 04:21:30 +0000
commit1d4785470db018d46fc247d1d11e12aa25352c08 (patch)
treec78be9d59d176ef0a5ba42d570b799209f1f4156 /lib/banzai
parent6d1b5850342a91ebdff07bb57722ce28e31b773f (diff)
downloadgitlab-ce-1d4785470db018d46fc247d1d11e12aa25352c08.tar.gz
Resolve "Process urls with spaces in all markdown processing"
Diffstat (limited to 'lib/banzai')
-rw-r--r--lib/banzai/filter/spaced_link_filter.rb7
-rw-r--r--lib/banzai/pipeline/gfm_pipeline.rb1
-rw-r--r--lib/banzai/pipeline/wiki_pipeline.rb1
3 files changed, 5 insertions, 4 deletions
diff --git a/lib/banzai/filter/spaced_link_filter.rb b/lib/banzai/filter/spaced_link_filter.rb
index a4dd6abfe03..a27f1d46863 100644
--- a/lib/banzai/filter/spaced_link_filter.rb
+++ b/lib/banzai/filter/spaced_link_filter.rb
@@ -10,11 +10,12 @@ module Banzai
#
# CommonMark does not allow spaces in the url portion of a link/url.
# For example, `[example](page slug)` is not valid.
- # Neither is `![example](test image.jpg)`. However,
+ # Neither is `![example](test image.jpg)`. However, particularly
# in our wikis, we support (via RedCarpet) this type of link, allowing
# wiki pages to be easily linked by their title. This filter adds that functionality.
- # The intent is for this to only be used in Wikis - in general, we want
- # to adhere to CommonMark's spec.
+ #
+ # This is a small extension to the CommonMark spec. If they start allowing
+ # spaces in urls, we could then remove this filter.
#
class SpacedLinkFilter < HTML::Pipeline::Filter
include ActionView::Helpers::TagHelper
diff --git a/lib/banzai/pipeline/gfm_pipeline.rb b/lib/banzai/pipeline/gfm_pipeline.rb
index e9be05e174e..bd34614f149 100644
--- a/lib/banzai/pipeline/gfm_pipeline.rb
+++ b/lib/banzai/pipeline/gfm_pipeline.rb
@@ -16,6 +16,7 @@ module Banzai
Filter::MathFilter,
Filter::ColorFilter,
Filter::MermaidFilter,
+ Filter::SpacedLinkFilter,
Filter::VideoLinkFilter,
Filter::ImageLazyLoadFilter,
Filter::ImageLinkFilter,
diff --git a/lib/banzai/pipeline/wiki_pipeline.rb b/lib/banzai/pipeline/wiki_pipeline.rb
index d2fe5a6492f..c37b8e71cb0 100644
--- a/lib/banzai/pipeline/wiki_pipeline.rb
+++ b/lib/banzai/pipeline/wiki_pipeline.rb
@@ -5,7 +5,6 @@ module Banzai
@filters ||= begin
super.insert_after(Filter::TableOfContentsFilter, Filter::GollumTagsFilter)
.insert_before(Filter::TaskListFilter, Filter::WikiLinkFilter)
- .insert_before(Filter::VideoLinkFilter, Filter::SpacedLinkFilter)
end
end
end