Use the WikiPipeline when rendering the wiki markdown content

parent a6a5990e
...@@ -91,7 +91,7 @@ module GitlabMarkdownHelper ...@@ -91,7 +91,7 @@ module GitlabMarkdownHelper
def render_wiki_content(wiki_page) def render_wiki_content(wiki_page)
case wiki_page.format case wiki_page.format
when :markdown when :markdown
markdown(wiki_page.content) markdown(wiki_page.content, pipeline: :wiki, project_wiki: @project_wiki)
when :asciidoc when :asciidoc
asciidoc(wiki_page.content) asciidoc(wiki_page.content)
else else
......
require 'banzai'
module Banzai
module Pipeline
class GollumTagsPipeline < BasePipeline
def self.filters
[
Filter::GollumTagsFilter
]
end
end
end
end
require 'banzai'
module Banzai
module Pipeline
class WikiPipeline < CombinedPipeline.new(PlainMarkdownPipeline, GollumTagsPipeline, GfmPipeline)
end
end
end
...@@ -121,12 +121,13 @@ describe GitlabMarkdownHelper do ...@@ -121,12 +121,13 @@ describe GitlabMarkdownHelper do
before do before do
@wiki = double('WikiPage') @wiki = double('WikiPage')
allow(@wiki).to receive(:content).and_return('wiki content') allow(@wiki).to receive(:content).and_return('wiki content')
helper.instance_variable_set(:@project_wiki, @wiki)
end end
it "should use GitLab Flavored Markdown for markdown files" do it "should use Wiki pipeline for markdown files" do
allow(@wiki).to receive(:format).and_return(:markdown) allow(@wiki).to receive(:format).and_return(:markdown)
expect(helper).to receive(:markdown).with('wiki content') expect(helper).to receive(:markdown).with('wiki content', pipeline: :wiki, project_wiki: @wiki)
helper.render_wiki_content(@wiki) helper.render_wiki_content(@wiki)
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment