vampysite/source/_plugins/kramdown-image.rb

12 lines
424 B
Ruby
Raw Permalink Normal View History

2022-07-14 10:12:30 +00:00
# https://github.com/gettalong/kramdown/issues/98#issuecomment-495169800
require 'kramdown/converter/html'
module StandaloneImages
def convert_p(el, indent)
return super unless el.children.size == 1 && (el.children.first.type == :img || (el.children.first.type == :html_element && el.children.first.value == "img"))
convert(el.children.first, indent)
end
end
Kramdown::Converter::Html.prepend StandaloneImages