Read about our upcoming Code of Conduct on this issue

This instance was upgraded to Heptapod 0.28.0 today

gfm_pipeline.rb 1.74 KB
Newer Older
1
2
3
module Banzai
  module Pipeline
    class GfmPipeline < BasePipeline
Douwe Maan's avatar
Douwe Maan committed
4
      # These filters convert GitLab Flavored Markdown (GFM) to HTML.
5
      # The handlers defined in app/assets/javascripts/behaviors/markdown/copy_as_gfm.js
6
7
      # 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
8
      # app/assets/javascripts/behaviors/markdown/copy_as_gfm.js, in reverse order.
Douwe Maan's avatar
Douwe Maan committed
9
      # The GFM-to-HTML-to-GFM cycle is tested in spec/features/copy_as_gfm_spec.rb.
10
      def self.filters
11
        @filters ||= FilterArray[
Horacio Sanson's avatar
Horacio Sanson committed
12
          Filter::PlantumlFilter,
13
          Filter::SanitizationFilter,
14
          Filter::SyntaxHighlightFilter,
15

16
          Filter::MathFilter,
17
          Filter::ColorFilter,
18
          Filter::MermaidFilter,
19
          Filter::VideoLinkFilter,
20
          Filter::ImageLazyLoadFilter,
21
          Filter::ImageLinkFilter,
22
23
24
25
26
27
          Filter::EmojiFilter,
          Filter::TableOfContentsFilter,
          Filter::AutolinkFilter,
          Filter::ExternalLinkFilter,

          Filter::UserReferenceFilter,
28
          Filter::ProjectReferenceFilter,
29
30
31
32
33
34
35
          Filter::IssueReferenceFilter,
          Filter::ExternalIssueReferenceFilter,
          Filter::MergeRequestReferenceFilter,
          Filter::SnippetReferenceFilter,
          Filter::CommitRangeReferenceFilter,
          Filter::CommitReferenceFilter,
          Filter::LabelReferenceFilter,
36
          Filter::MilestoneReferenceFilter,
37

38
          Filter::TaskListFilter,
39
40
41
          Filter::InlineDiffFilter,

          Filter::SetDirectionFilter
42
43
44
45
        ]
      end

      def self.transform_context(context)
46
        context[:only_path] = true unless context.key?(:only_path)
47

48
        context
49
50
51
52
      end
    end
  end
end