Function parse_hyperlinks_extras::parser::html::html_img[][src]

pub fn html_img(i: &str) -> IResult<&str, (Cow<'_, str>, Cow<'_, str>)>
Expand description

Parse an HTML image.

It returns either Ok((i, (img_alt, img_src))) or some error.

The parser expects to start at the link start (<) to succeed.

use parse_hyperlinks;
use parse_hyperlinks_extras::parser::html::html_img;
use std::borrow::Cow;

assert_eq!(
  html_img(r#"<img src="/images/my&amp;dog.png" alt="my Dog" width="500">abc"#),
  Ok(("abc", (Cow::from("my Dog"), Cow::from("/images/my&dog.png"))))
);