end
def first_image_element(element)
- return element if element.type == :img
+ return element if element.type == :img ||
+ (element.type == :html_element && element.value == "img")
element.children.find do |child|
nested_image = first_image_element(child)
assert_equal "https://example.com/image1.jpg", r.image
end
+ def test_markdown_html_image
+ r = RichText.new("markdown", "<img src='https://example.com/img_element.png'>")
+ assert_equal "https://example.com/img_element.png", r.image
+ end
+
private
def assert_html(richtext, &block)