gitlab-org--gitlab-foss/lib/banzai/pipeline/post_process_pipeline.rb
Sarah Yasonik 7d393bd852 Expose metrics element for FE consumption
Adds GFM Pipline filters to insert a placeholder in the generated
HTML from GFM based on the presence of a metrics dashboard link.

The front end should look for the class 'js-render-metrics' to
determine if it should replace the element with metrics charts.
The data element 'data-dashboard-url' should be the endpoint
the front end should hit in order to obtain a dashboard layout
in order to appropriately render the charts.
2019-07-10 11:27:25 +00:00

30 lines
650 B
Ruby

# frozen_string_literal: true
module Banzai
module Pipeline
class PostProcessPipeline < BasePipeline
def self.filters
@filters ||= FilterArray[
*internal_link_filters,
Filter::AbsoluteLinkFilter
]
end
def self.internal_link_filters
[
Filter::RedactorFilter,
Filter::InlineMetricsRedactorFilter,
Filter::RelativeLinkFilter,
Filter::IssuableStateFilter,
Filter::SuggestionFilter
]
end
def self.transform_context(context)
context.merge(
post_process: true
)
end
end
end
end