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
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

View File

@ -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

View File

@ -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