]>
git.proxmox.com Git - rustc.git/blob - src/vendor/mdbook/src/lib.rs
3 //! **mdBook** is similar to Gitbook but implemented in Rust.
4 //! It offers a command line interface, but can also be used as a regular crate.
6 //! This is the API doc, but you can find a [less "low-level" documentation here](../index.html) that
7 //! contains information about the command line tool, format, structure etc.
8 //! It is also rendered with mdBook to showcase the features and default theme.
10 //! Some reasons why you would want to use the crate (over the cli):
12 //! - Integrate mdbook in a current project
13 //! - Extend the capabilities of mdBook
14 //! - Do some processing or test before building your book
15 //! - Write a new Renderer
21 //! extern crate mdbook;
23 //! use mdbook::MDBook;
24 //! use std::path::Path;
27 //! let mut book = MDBook::new(Path::new("my-book")) // Path to root
28 //! .set_src(Path::new("src")) // Path from root to source directory
29 //! .set_dest(Path::new("book")) // Path from root to output directory
30 //! .read_config(); // Parse book.json file for configuration
32 //! book.build().unwrap(); // Render the book
36 //! ## Implementing a new Renderer
38 //! If you want to create a new renderer for mdBook, the only thing you have to do is to implement
39 //! the [Renderer trait](renderer/renderer/trait.Renderer.html)
41 //! And then you can swap in your renderer like this:
44 //! # extern crate mdbook;
46 //! # use mdbook::MDBook;
47 //! # use mdbook::renderer::HtmlHandlebars;
48 //! # use std::path::Path;
51 //! # let your_renderer = HtmlHandlebars::new();
53 //! let book = MDBook::new(Path::new("my-book")).set_renderer(Box::new(your_renderer));
56 //! If you make a renderer, you get the book constructed in form of `Vec<BookItems>` and you get
57 //! the book config in a `BookConfig` struct.
59 //! It's your responsability to create the necessary files in the correct directories.
63 //! I have regrouped some useful functions in the [utils](utils/index.html) module, like the following function
66 //! utils::fs::create_path(path: &Path)
68 //! This function creates all the directories in a given path if they do not exist
70 //! Make sure to take a look at it.
74 extern crate serde_json
;
75 extern crate handlebars
;
76 extern crate pulldown_cmark
;
79 #[macro_use] extern crate log;
87 pub use book
::BookItem
;
88 pub use book
::BookConfig
;
89 pub use renderer
::Renderer
;