Class: Parliament::Utils::Services::ParliamentMarkdownScrubber

Inherits:
Rails::Html::PermitScrubber
  • Object
show all
Defined in:
lib/parliament/utils/services/markdown_scrubber.rb

Instance Method Summary collapse

Constructor Details

#initializeParliamentMarkdownScrubber

Overrides default sanitization allowing Parliament tags and/or attributes



6
7
8
9
10
11
# File 'lib/parliament/utils/services/markdown_scrubber.rb', line 6

def initialize
  super

  self.tags = %w[p div h1 h2 h3 h4 h5 h6 span a ol li ul strong em i itag strike del u sup sub blockquote cite table thead tbody tfoot tr th td iframe image pre code dl dt dd hr br]
  self.attributes = %w[class href src name title allowfullscreen seamless frameborder style]
end

Instance Method Details

#skip_node?(node) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/parliament/utils/services/markdown_scrubber.rb', line 13

def skip_node?(node)
  node.text? || node.name === 'iframe'
end