gitlab-org--gitlab-foss/lib/banzai/pipeline/gfm_pipeline.rb

54 lines
1.7 KiB
Ruby
Raw Normal View History

module Banzai
module Pipeline
class GfmPipeline < BasePipeline
2017-01-16 18:11:15 -05:00
# 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.
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.
def self.filters
2016-03-01 15:54:35 -05:00
@filters ||= FilterArray[
Filter::PlantumlFilter,
Filter::SanitizationFilter,
Filter::SyntaxHighlightFilter,
Filter::MathFilter,
Filter::UploadLinkFilter,
Filter::VideoLinkFilter,
Filter::ImageLinkFilter,
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,
Filter::TaskListFilter,
2016-09-11 12:08:09 -04:00
Filter::InlineDiffFilter,
Filter::SetDirectionFilter
]
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