Class: Banzai::Filter::ColorFilter

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

Overview

HTML filter that renders `color` followed by a color “chip”.

Constant Summary collapse

COLOR_CHIP_CLASS =
'gfm-color_chip'

Instance Method Summary collapse

Instance Method Details

#callObject


10
11
12
13
14
15
16
17
# File 'lib/banzai/filter/color_filter.rb', line 10

def call
  doc.css('code').each do |node|
    color = ColorParser.parse(node.content)
    node << color_chip(color) if color
  end

  doc
end