Before MarkdownParagraphChunk::Image was pushed for every Text event if
we're currently inside an image. This was wrong since pulldown-cmark
parses `` as:
Start(Image { link_type: Inline, dest_url: "foo", title: "", id: "" })
End(Image)
If there is no alt text, no Text event is emitted. Which caused images
without any alt text not to be rendered at all.
For alt texts containing inline formatting this was even more obviously
broken since e.g. `` gets parsed as:
Start(Image { link_type: Inline, dest_url: "foo", title: "", id: "" })
Text(Borrowed("foo "))
Start(Emphasis)
Text(Borrowed("bar"))
End(Emphasis)
Text(Borrowed(" baz"))
End(Image)
which for this example caused the image to appear 3 times in the
preview.
This commit fixes these two bugs which have existed since the
introduction of the image previews in
96854c68ea.
Release Notes:
- Fixed images in the markdown preview appearing not at all or too
often.