summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Mazetto <gabriel@gitlab.com>2016-04-01 15:03:39 -0300
committerGabriel Mazetto <gabriel@gitlab.com>2016-04-06 03:30:56 -0300
commit207b7218aa4394dc24c68041eade04474ff41537 (patch)
tree6f9cde70ccd9b0b5f757b868875bd01cdc141148
parent22055e10580ae93c2cb87956eefba0a06e9b50d0 (diff)
downloadgitlab-ce-patch/fix-markdown-preview-wikis.tar.gz
Ensure correct filter order to validate with our markdown specpatch/fix-markdown-preview-wikis
-rw-r--r--lib/banzai/filter/gollum_tags_filter.rb8
-rw-r--r--lib/banzai/pipeline/wiki_pipeline.rb2
-rw-r--r--spec/features/markdown_spec.rb2
3 files changed, 8 insertions, 4 deletions
diff --git a/lib/banzai/filter/gollum_tags_filter.rb b/lib/banzai/filter/gollum_tags_filter.rb
index cfd3e28ed09..f710a4971b0 100644
--- a/lib/banzai/filter/gollum_tags_filter.rb
+++ b/lib/banzai/filter/gollum_tags_filter.rb
@@ -118,7 +118,7 @@ module Banzai
end
if path
- content_tag(:img, nil, src: path)
+ content_tag(:img, nil, src: path, class: tag_class('image'))
end
end
@@ -155,7 +155,7 @@ module Banzai
href = ::File.join(project_wiki_base_path, reference)
end
- content_tag(:a, name || reference, href: href)
+ content_tag(:a, name || reference, href: href, class: tag_class('page'))
end
def project_wiki
@@ -172,6 +172,10 @@ module Banzai
def validate
needs :project_wiki
end
+
+ def tag_class(type)
+ "gfm gollum gollum-#{type}"
+ end
end
end
end
diff --git a/lib/banzai/pipeline/wiki_pipeline.rb b/lib/banzai/pipeline/wiki_pipeline.rb
index bcb89485dec..c37b8e71cb0 100644
--- a/lib/banzai/pipeline/wiki_pipeline.rb
+++ b/lib/banzai/pipeline/wiki_pipeline.rb
@@ -4,7 +4,7 @@ module Banzai
def self.filters
@filters ||= begin
super.insert_after(Filter::TableOfContentsFilter, Filter::GollumTagsFilter)
- .insert_after(Filter::TableOfContentsFilter, Filter::WikiLinkFilter)
+ .insert_before(Filter::TaskListFilter, Filter::WikiLinkFilter)
end
end
end
diff --git a/spec/features/markdown_spec.rb b/spec/features/markdown_spec.rb
index 5149ce9cf2f..3d0d0e59fd7 100644
--- a/spec/features/markdown_spec.rb
+++ b/spec/features/markdown_spec.rb
@@ -39,7 +39,7 @@ describe 'GitLab Markdown', feature: true do
end
def doc(html = @html)
- Nokogiri::HTML::DocumentFragment.parse(html)
+ @doc ||= Nokogiri::HTML::DocumentFragment.parse(html)
end
# Shared behavior that all pipelines should exhibit