2015-12-23 02:04:40 +05:30
|
|
|
module Banzai
|
|
|
|
module Pipeline
|
|
|
|
class GfmPipeline < BasePipeline
|
2017-08-17 22:00:37 +05:30
|
|
|
# These filters convert GitLab Flavored Markdown (GFM) to HTML.
|
|
|
|
# The handlers defined in app/assets/javascripts/copy_as_gfm.js
|
|
|
|
# consequently convert that same HTML to GFM to be copied to the clipboard.
|
|
|
|
# Every filter that generates HTML from GFM should have a handler in
|
|
|
|
# app/assets/javascripts/copy_as_gfm.js, in reverse order.
|
|
|
|
# The GFM-to-HTML-to-GFM cycle is tested in spec/features/copy_as_gfm_spec.rb.
|
2015-12-23 02:04:40 +05:30
|
|
|
def self.filters
|
2016-06-02 11:05:42 +05:30
|
|
|
@filters ||= FilterArray[
|
2017-08-17 22:00:37 +05:30
|
|
|
Filter::PlantumlFilter,
|
2015-12-23 02:04:40 +05:30
|
|
|
Filter::SanitizationFilter,
|
2017-08-17 22:00:37 +05:30
|
|
|
Filter::SyntaxHighlightFilter,
|
2015-12-23 02:04:40 +05:30
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
Filter::MathFilter,
|
2018-03-17 18:26:18 +05:30
|
|
|
Filter::ColorFilter,
|
|
|
|
Filter::MermaidFilter,
|
2016-08-24 12:49:21 +05:30
|
|
|
Filter::VideoLinkFilter,
|
2017-09-10 17:25:29 +05:30
|
|
|
Filter::ImageLazyLoadFilter,
|
2016-06-02 11:05:42 +05:30
|
|
|
Filter::ImageLinkFilter,
|
2015-12-23 02:04:40 +05:30
|
|
|
Filter::EmojiFilter,
|
|
|
|
Filter::TableOfContentsFilter,
|
|
|
|
Filter::AutolinkFilter,
|
|
|
|
Filter::ExternalLinkFilter,
|
|
|
|
|
|
|
|
Filter::UserReferenceFilter,
|
|
|
|
Filter::IssueReferenceFilter,
|
|
|
|
Filter::ExternalIssueReferenceFilter,
|
|
|
|
Filter::MergeRequestReferenceFilter,
|
|
|
|
Filter::SnippetReferenceFilter,
|
|
|
|
Filter::CommitRangeReferenceFilter,
|
|
|
|
Filter::CommitReferenceFilter,
|
|
|
|
Filter::LabelReferenceFilter,
|
2016-01-14 18:37:52 +05:30
|
|
|
Filter::MilestoneReferenceFilter,
|
2015-12-23 02:04:40 +05:30
|
|
|
|
2016-06-02 11:05:42 +05:30
|
|
|
Filter::TaskListFilter,
|
2016-11-03 12:29:30 +05:30
|
|
|
Filter::InlineDiffFilter,
|
|
|
|
|
|
|
|
Filter::SetDirectionFilter
|
2015-12-23 02:04:40 +05:30
|
|
|
]
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.transform_context(context)
|
|
|
|
context.merge(
|
|
|
|
only_path: true,
|
|
|
|
|
|
|
|
# EmojiFilter
|
|
|
|
asset_host: Gitlab::Application.config.asset_host,
|
|
|
|
asset_root: Gitlab.config.gitlab.base_url
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|