use http::uri::Uri; use mdiu::*; fn kitchen_sink() -> Result> { let mut parts = http::uri::Parts::default(); parts.path_and_query = Some("one-link".parse().unwrap()); let one_link = Uri::from_parts(parts).unwrap(); let lines = Document::new() .h1("title") .h2("section") .h3("subsection") .empty() .text("text") .link_with_label(one_link, "one link") .quote("quote") .preformatted("@_@".to_string()) .text("more text") .preformatted_with_alt("@_@".into(), "emoticon") .list_item("one item") .link(Uri::from_static("no-text")) .link_with_label(Uri::from_static("with-text"), "with text") .list_item("an item") .list_item("another item") .build()?; Ok(lines) } #[test] fn gemtext() { let expected = r#"# title ## section ### subsection text => one-link one link > quote ``` @_@ ``` more text ```emoticon @_@ ``` * one item => no-text => with-text with text * an item * another item "#; assert_eq!(expected, &kitchen_sink().unwrap().to_markup::()); } #[cfg(feature = "html")] #[test] fn html() { let expected = r#"

title

section

subsection

text

quote
@_@

more text

@_@
"#; assert_eq!(expected, &kitchen_sink().unwrap().to_markup::()); } #[cfg(feature = "markdown")] #[test] fn markdown() { let expected = r#"# title ## section ### subsection text * [one link](one-link) > quote @_@ more text @_@ * one item * [no-text](no-text) * [with text](with-text) * an item * another item "#; assert_eq!(expected, &kitchen_sink().unwrap().to_markup::()); }