Sha256: d1efd1053b2a688a0cd2a886abf1603b86d0f2ead4a502ebd11b6f49fb8fa65d

Contents?: true

Size: 387 Bytes

Versions: 2

Compression:

Stored size: 387 Bytes

Contents

# frozen_string_literal: true

module Kramdown
  module Converter
    module Amp
      def convert_img(el, indent)
        img_src = el.attr["src"]
        img_src = img_src.slice(1..-1) if img_src.start_with?("/")
        w, h = FastImage.size(img_src)

        "<amp-img#{html_attributes(el.attr)} width='#{w}' height='#{h}' layout='responsive'></amp-img>"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
kramdown-amp-0.2.0 lib/kramdown/converter/amp.rb
kramdown-amp-0.1.0 lib/kramdown/converter/amp.rb