Class: Banzai::Filter::AsciiDocPostProcessingFilter

Inherits:
HTML::Pipeline::Filter
  • Object
show all
Defined in:
lib/banzai/filter/ascii_doc_post_processing_filter.rb

Constant Summary collapse

CSS_MATH =
'[data-math-style]'
XPATH_MATH =
Gitlab::Utils::Nokogiri.css_to_xpath(CSS_MATH).freeze
CSS_MERM =
'[data-mermaid-style]'
XPATH_MERM =
Gitlab::Utils::Nokogiri.css_to_xpath(CSS_MERM).freeze

Instance Method Summary collapse

Instance Method Details

#callObject



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/banzai/filter/ascii_doc_post_processing_filter.rb', line 11

def call
  doc.xpath(XPATH_MATH).each do |node|
    node.set_attribute('class', 'code math js-render-math')
  end

  doc.xpath(XPATH_MERM).each do |node|
    node.set_attribute('class', 'js-render-mermaid')
  end

  doc
end