Commit b4828f4c authored by Marin Jankovski's avatar Marin Jankovski

Enable markdown pipeline filters from inside gitlab.

parent 2fb99c79
...@@ -70,14 +70,17 @@ module Gitlab ...@@ -70,14 +70,17 @@ module Gitlab
insert_piece($1) insert_piece($1)
end end
# Context passed to the markdoqwn pipeline # Used markdown pipelines in GitLab:
markdown_context = { # GitlabEmojiFilter - performs emoji replacement.
asset_root: File.join(root_url, #
Gitlab::Application.config.assets.prefix) # see https://gitlab.com/gitlab-org/html-pipeline-gitlab for more filters
} filters = [
HTML::Pipeline::Gitlab::GitlabEmojiFilter
result = HTML::Pipeline::Gitlab::MarkdownPipeline.call(text, ]
markdown_context)
markdown_pipeline = HTML::Pipeline::Gitlab.new(filters).pipeline
result = markdown_pipeline.call(text)
text = result[:output].to_html(save_with: 0) text = result[:output].to_html(save_with: 0)
allowed_attributes = ActionView::Base.sanitized_allowed_attributes allowed_attributes = ActionView::Base.sanitized_allowed_attributes
......
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