Sha256: fe66f9f1624cd6bb5cd0f81fe29956a5905d73f86da307fec355a292b53e3213

Contents?: true

Size: 420 Bytes

Versions: 14

Compression:

Stored size: 420 Bytes

Contents

module ReverseMarkdown
  module Converters
    class Em < Base
      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
    end

    register :em, Em.new
    register :i,  Em.new
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
reverse_markdown-3.0.0 lib/reverse_markdown/converters/em.rb
getargv-0.3.3-universal-darwin vendor/bundle/ruby/3.3.0/gems/reverse_markdown-2.1.1/lib/reverse_markdown/converters/em.rb
reverse_markdown-2.1.1 lib/reverse_markdown/converters/em.rb
reverse_markdown-2.0.0 lib/reverse_markdown/converters/em.rb
reverse_markdown-1.4.0 lib/reverse_markdown/converters/em.rb
reverse_markdown-1.3.0 lib/reverse_markdown/converters/em.rb
reverse_markdown-1.2.0 lib/reverse_markdown/converters/em.rb
reverse_markdown-1.1.0 lib/reverse_markdown/converters/em.rb
reverse_markdown-1.0.5 lib/reverse_markdown/converters/em.rb
reverse_markdown-1.0.4 lib/reverse_markdown/converters/em.rb
reverse_markdown-1.0.3 lib/reverse_markdown/converters/em.rb
reverse_markdown-1.0.2 lib/reverse_markdown/converters/em.rb
reverse_markdown-1.0.1 lib/reverse_markdown/converters/em.rb
reverse_markdown-1.0.0 lib/reverse_markdown/converters/em.rb