debian-mirror-gitlab/lib/banzai/filter/mermaid_filter.rb
2021-06-02 17:11:27 +05:30

18 lines
438 B
Ruby

# frozen_string_literal: true
# Generated HTML is transformed back to GFM by app/assets/javascripts/behaviors/markdown/nodes/code_block.js
module Banzai
module Filter
class MermaidFilter < HTML::Pipeline::Filter
CSS = 'pre[lang="mermaid"] > code'
XPATH = Gitlab::Utils::Nokogiri.css_to_xpath(CSS).freeze
def call
doc.xpath(XPATH).add_class('js-render-mermaid')
doc
end
end
end
end