Skip to content

Parsing `<img>` tag fails if it contains width or height attributes

The following works as expected:

    let parsed = parse_html(
      r#"<img src="https://example.com/image.jpg" />"#,
    );
    assert_eq!("![](https://example.com/image.jpg)", parsed);

However this fails:

    let parsed = parse_html(
      r#"<img width="128" src="https://example.com/image.jpg" />"#,
    );
    // actually returns `<img src="https://example.com/image.jpg" width="128" />`
    assert_eq!("![](https://example.com/image.jpg)", parsed);

The same problem also happens when the img tag contains width

Edited by Felix