Skip to content

Should $clean_tags_re contain img? #402

Description

@edent

If I have this HTML:

<img src="example.png" alt="Alt text

With

Multiple newlines." >

It is transformed into:

<p>&lt;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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions