Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ascii_doc_post_processing_filter.rb « filter « banzai « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 09f0fd7df4598047c45c0d6a536fe5d3eeb2b925 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# frozen_string_literal: true

module Banzai
  module Filter
    class AsciiDocPostProcessingFilter < HTML::Pipeline::Filter
      def call
        doc.search('[data-math-style]').each do |node|
          node.set_attribute('class', 'code math js-render-math')
        end

        doc.search('[data-mermaid-style]').each do |node|
          node.set_attribute('class', 'js-render-mermaid')
        end
        doc
      end
    end
  end
end