use http::Uri;
use mdiu::{Block, Content, Link};

pub fn invalid_content() -> Content {
    Content::new("Invalid content").unwrap()
}

pub fn lnk(uri: Uri, opt_label: Option<String>) -> Block {
    if let Some(text) = opt_label {
        Block::Link(Link::new(
            uri,
            Some(Content::new(text).unwrap_or(invalid_content())),
        ))
    } else {
        Block::Link(Link::new(uri, None))
    }
}
