* If href is nil, allow node * Add unit test showing no change My first pass had the `<a>` within an h1 content, but the scrubber added a newline after the closing a tag?
13 lines
366 B
Ruby
13 lines
366 B
Ruby
class FeedMarkdownScrubber < Rails::Html::PermitScrubber
|
|
def initialize
|
|
super
|
|
self.tags = MarkdownProcessor::AllowedTags::FEED
|
|
self.attributes = MarkdownProcessor::AllowedAttributes::FEED
|
|
end
|
|
|
|
def allowed_node?(node)
|
|
return true if tags.include?(node.name) && node.name != "a"
|
|
|
|
node.name == "a" && !node["href"]&.start_with?("#")
|
|
end
|
|
end
|