2015-08-06 12:38:48 +02:00
|
|
|
# Rust Library
|
|
|
|
|
|
2015-08-06 15:09:37 +02:00
|
|
|
Check here for the [API docs](../mdbook/index.html) generated by rustdoc.
|
|
|
|
|
|
2015-08-06 12:38:48 +02:00
|
|
|
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:
|
|
|
|
|
|
|
|
|
|
```rust
|
|
|
|
|
extern crate mdBook;
|
|
|
|
|
|
|
|
|
|
use mdBook::MDBook;
|
2015-08-06 14:09:55 +02:00
|
|
|
use std::path::Path;
|
2015-08-06 12:38:48 +02:00
|
|
|
|
|
|
|
|
fn main() {
|
2015-08-06 14:09:55 +02:00
|
|
|
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
|
2015-08-06 12:38:48 +02:00
|
|
|
|
2015-08-06 14:09:55 +02:00
|
|
|
book.build().unwrap(); // Render the book
|
2015-08-06 12:38:48 +02:00
|
|
|
}
|
|
|
|
|
```
|