Sha256: 2ec7ac6ebb065530f67080cf3ee3d0b262ae4468bd32a997a54e7fcde0e58dd2

Contents?: true

Size: 598 Bytes

Versions: 2

Compression:

Stored size: 598 Bytes

Contents

# This is the custom kramdown converter class we will be using to render
# HTML from Markdown. It's essentially a handy way to hook into various
# elements and add our own logic (like supporting oEmbed embeds in
# Markdown image elements.)
#
class Kramdown::Converter::SlodownHtml < Kramdown::Converter::Html
  # Hook into image tags to allow oEmbed embeds.
  #
  def convert_img(el, indent)
    oembed = OEmbed::Providers.get(el.attr['src'])
    %q(<div class="embedded %s %s">%s</div>) % [oembed.type, oembed.provider_name.parameterize, oembed.html]
  rescue OEmbed::NotFound
    super
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
slodown-0.1.3 lib/kramdown/converter/slodown_html.rb
slodown-0.1.2 lib/kramdown/converter/slodown_html.rb