lib/reverse_markdown/converters/strong.rb in reverse_markdown-0.8.2 vs lib/reverse_markdown/converters/strong.rb in reverse_markdown-1.0.0

- old
+ new

@@ -1,18 +1,14 @@ module ReverseMarkdown module Converters class Strong < Base - def convert(node) - content = treat_children(node) - if content.strip.empty? || already_strong?(node) + def convert(node, state = {}) + content = treat_children(node, state.merge(already_strong: true)) + if content.strip.empty? || state[:already_strong] content else "#{content[/^\s*/]}**#{content.strip}**#{content[/\s*$/]}" end - end - - def already_strong?(node) - node.ancestors('strong').size > 0 || node.ancestors('b').size > 0 end end register :strong, Strong.new register :b, Strong.new