class ReverseMarkdown::Converters::Em

Public Instance Methods

convert(node, state = {}) click to toggle source
# File lib/reverse_markdown/converters/em.rb, line 4
def convert(node, state = {})
  content = treat_children(node, state.merge(already_italic: true))
  if content.strip.empty? || state[:already_italic]
    content
  else
    "#{content[/^\s*/]}_#{content.strip}_#{content[/\s*$/]}"
  end
end