class SlackMarkdown::Filters::LineBreakFilter

Public Instance Methods

call() click to toggle source
# File lib/slack_markdown/filters/line_break_filter.rb, line 11
def call
  doc.search('.//text()').each do |node|
    content = node.to_html
    next if has_ancestor?(node, ignored_ancestor_tags)
    next unless content.include?("\n")
    html = content.gsub("\n", '<br>')
    next if html == content
    node.replace(html)
  end
  doc
end