2015-12-15 09:51:16 -05:00
|
|
|
module Banzai
|
|
|
|
module Pipeline
|
|
|
|
class GfmPipeline < BasePipeline
|
2017-01-16 18:11:15 -05:00
|
|
|
# These filters convert GitLab Flavored Markdown (GFM) to HTML.
|
2017-03-15 19:31:01 -04:00
|
|
|
# The handlers defined in app/assets/javascripts/copy_as_gfm.js
|
2017-01-17 13:07:49 -05:00
|
|
|
# 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
|
2017-03-15 19:31:01 -04:00
|
|
|
# app/assets/javascripts/copy_as_gfm.js, in reverse order.
|
2017-01-16 18:11:15 -05:00
|
|
|
# The GFM-to-HTML-to-GFM cycle is tested in spec/features/copy_as_gfm_spec.rb.
|
2015-12-15 09:51:16 -05:00
|
|
|
def self.filters
|
2016-03-01 15:54:35 -05:00
|
|
|
@filters ||= FilterArray[
|
2017-01-15 19:07:02 -05:00
|
|
|
Filter::PlantumlFilter,
|
2015-12-15 09:51:16 -05:00
|
|
|
Filter::SanitizationFilter,
|
2017-04-02 13:39:41 -04:00
|
|
|
Filter::SyntaxHighlightFilter,
|
2015-12-15 09:51:16 -05:00
|
|
|
|
2016-12-08 19:15:08 -05:00
|
|
|
Filter::MathFilter,
|
2015-12-15 09:51:16 -05:00
|
|
|
Filter::UploadLinkFilter,
|
2016-04-03 01:00:06 -04:00
|
|
|
Filter::VideoLinkFilter,
|
2017-07-24 13:36:52 -04:00
|
|
|
Filter::ImageLazyLoadFilter,
|
2016-07-12 13:31:20 -04:00
|
|
|
Filter::ImageLinkFilter,
|
2015-12-15 09:51:16 -05:00
|
|
|
Filter::EmojiFilter,
|
|
|
|
Filter::TableOfContentsFilter,
|
|
|
|
Filter::AutolinkFilter,
|
|
|
|
Filter::ExternalLinkFilter,
|
|
|
|
|
|
|
|
Filter::UserReferenceFilter,
|
|
|
|
Filter::IssueReferenceFilter,
|
|
|
|
Filter::ExternalIssueReferenceFilter,
|
|
|
|
Filter::MergeRequestReferenceFilter,
|
|
|
|
Filter::SnippetReferenceFilter,
|
|
|
|
Filter::CommitRangeReferenceFilter,
|
|
|
|
Filter::CommitReferenceFilter,
|
|
|
|
Filter::LabelReferenceFilter,
|
2015-12-24 08:43:07 -05:00
|
|
|
Filter::MilestoneReferenceFilter,
|
2015-12-15 09:51:16 -05:00
|
|
|
|
2016-04-06 15:37:09 -04:00
|
|
|
Filter::TaskListFilter,
|
2016-09-11 12:08:09 -04:00
|
|
|
Filter::InlineDiffFilter,
|
|
|
|
|
|
|
|
Filter::SetDirectionFilter
|
2015-12-15 09:51:16 -05:00
|
|
|
]
|
|
|
|
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
|