Sha256: 66b84d78658812caf4b3a3f2b4e22ea0692c911cfbae88c36006699f9ccf43dc

Contents?: true

Size: 600 Bytes

Versions: 2

Compression:

Stored size: 600 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 StandardError => e
    super
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
slodown-0.3.0 lib/kramdown/converter/slodown_html.rb
slodown-0.2.0 lib/kramdown/converter/slodown_html.rb