mdbook/book-example/src/lib/lib.md
2015-08-06 15:24:34 +02:00

741 B

Rust Library

Check here for the API docs generated by rustdoc.

mdBook is not only a command line tool, it can be used as a crate. You can extend it, integrate it in current projects. Here is a short example:

extern crate mdbook;

use mdbook::MDBook;
use std::path::Path;

fn main() {
    let book =  MDBook::new(Path::new("my-book"))   // Path to root
                    .set_src(Path::new("src"))      // Path from root to source directory
                    .set_dest(Path::new("book"))    // Path from root to output directory
                    .read_config()                  // Parse book.json file for configuration

    book.build().unwrap();                          // Render the book
}