Skip to main content

from_html

Function from_html 

Source
pub fn from_html(html: &str, url: &Url) -> Result<Document, Error>
Expand description

Parses the provided HTML into a types::Document resolved with the proviedd URL.

use microformats::from_html;

let base_url: url::Url = "https://example.com".parse().unwrap();
let document = from_html(r#"
<html>
    <head>
        <link rel="author me" href="/author">
    </head>
    <body>
    </body>
</html>
"#, &base_url);

assert!(document.is_ok());