If I have this HTML:
<img src="example.png" alt="Alt text
With
Multiple newlines." >
It is transformed into:
<p><img src="example.png" alt="Alt text</p>
<p>With</p>
<p>Multiple newlines." ></p>
Changing this line:
|
protected string $clean_tags_re = 'script|style|math|svg'; |
to
protected string $clean_tags_re = 'script|style|math|svg|img';
Fixes the issue.
I can't think of anything within an <img> element which should be altered by Markdown. Alt text can't contain HTML elements, src shouldn't be altered, it's a self-closing element so won't have any contents.
Are there any downsides to adding img to this regex?