Rust crate for generating Markdown files
```rust let file = File::create("test.md").unwrap(); let mut md = Markdown::new(file);
md.write("Heading".heading(1)).unwrap(); md.write("Subheading".italic().heading(2)).unwrap();
md.write("bold".bold()).unwrap();
md.write("first paragraph").unwrap(); md.write( "Links: ".paragraph() .append("Rust".bold().linkto("https://rust-lang.org")) .append(", ") .append("Google".italic().linkto("https://google.com")) ).unwrap();
md.write( List::new(true) .title("numbered list") .item("item 1") .item("bold".bold()) .item( List::new(false) .title("nested bullet list") .item( "bold".bold() .paragraph().append( "italic".italic() ) ) ) ).unwrap();
md.write("quote".quote()).unwrap();
This produces the following Markdown document
bold
first paragraph
numbered list 1. item 1 1. bold 1. nested bullet list * bolditalic
quote ```
You can also generate Markdown to Vec<u8>
:
```rust
let mut md = Markdown::new(Vec::new());
md.write("test".heading(1)).unwrap();
let vec = md.intoinner(); asserteq!(String::from_utf8(vec).unwrap(), "# test\n"); ```