Module: Kramdown::Converter::Amp

Included in:
Html
Defined in:
lib/kramdown/converter/amp.rb

Instance Method Summary collapse

Instance Method Details

#convert_img(el, indent) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/kramdown/converter/amp.rb', line 6

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