Ensure correct filter order to validate with our markdown spec

This commit is contained in:
Gabriel Mazetto 2016-04-01 15:03:39 -03:00
parent 22055e1058
commit 207b7218aa
3 changed files with 8 additions and 4 deletions

View File

@ -118,7 +118,7 @@ module Banzai
end end
if path if path
content_tag(:img, nil, src: path) content_tag(:img, nil, src: path, class: tag_class('image'))
end end
end end
@ -155,7 +155,7 @@ module Banzai
href = ::File.join(project_wiki_base_path, reference) href = ::File.join(project_wiki_base_path, reference)
end end
content_tag(:a, name || reference, href: href) content_tag(:a, name || reference, href: href, class: tag_class('page'))
end end
def project_wiki def project_wiki
@ -172,6 +172,10 @@ module Banzai
def validate def validate
needs :project_wiki needs :project_wiki
end end
def tag_class(type)
"gfm gollum gollum-#{type}"
end
end end
end end
end end

View File

@ -4,7 +4,7 @@ module Banzai
def self.filters def self.filters
@filters ||= begin @filters ||= begin
super.insert_after(Filter::TableOfContentsFilter, Filter::GollumTagsFilter) super.insert_after(Filter::TableOfContentsFilter, Filter::GollumTagsFilter)
.insert_after(Filter::TableOfContentsFilter, Filter::WikiLinkFilter) .insert_before(Filter::TaskListFilter, Filter::WikiLinkFilter)
end end
end end
end end

View File

@ -39,7 +39,7 @@ describe 'GitLab Markdown', feature: true do
end end
def doc(html = @html) def doc(html = @html)
Nokogiri::HTML::DocumentFragment.parse(html) @doc ||= Nokogiri::HTML::DocumentFragment.parse(html)
end end
# Shared behavior that all pipelines should exhibit # Shared behavior that all pipelines should exhibit