Commit 74751791 authored by Robert Speicher's avatar Robert Speicher

Add a PreProcessPipeline

parent 1fa7671f
......@@ -50,6 +50,8 @@ module GitlabMarkdownHelper
context[:project] ||= @project
text = Banzai.pre_process(text, context)
html = Banzai.render(text, context)
context.merge!(
......
......@@ -7,6 +7,10 @@ module Banzai
Renderer.render_result(text, context)
end
def self.pre_process(text, context)
Renderer.pre_process(text, context)
end
def self.post_process(html, context)
Renderer.post_process(html, context)
end
......
module Banzai
module Pipeline
class PreProcessPipeline < BasePipeline
def self.filters
[
]
end
def self.transform_context(context)
context.merge(
pre_process: true
)
end
end
end
end
......@@ -31,6 +31,12 @@ module Banzai
Pipeline[context[:pipeline]].call(text, context)
end
def self.pre_process(text, context)
pipeline = Pipeline[:pre_process]
pipeline.to_html(text, context)
end
# Perform post-processing on an HTML String
#
# This method is used to perform state-dependent changes to a String of
......
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