BigW Consortium Gitlab

description_pipeline.rb 556 Bytes
Newer Older
1 2
module Banzai
  module Pipeline
3 4
    class DescriptionPipeline < FullPipeline
      def self.transform_context(context)
5
        super(context).merge(
6
          # SanitizationFilter
7
          whitelist: whitelist
8 9
        )
      end
10 11 12 13 14 15 16 17 18 19 20

      private

      def self.whitelist
        # Descriptions are more heavily sanitized, allowing only a few elements.
        # See http://git.io/vkuAN
        whitelist = Banzai::Filter::SanitizationFilter::LIMITED
        whitelist[:elements] -= %w(pre code img ol ul li)

        whitelist
      end
21 22 23
    end
  end
end