[−][src]Struct mdbook::book::MDBook
The object used to manage and build a book.
Fields
root: PathBuf
The book's root directory.
config: Config
The configuration used to tweak now a book is built.
book: Book
A representation of the book's contents in memory.
Implementations
impl MDBook
[src]
pub fn load<P: Into<PathBuf>>(book_root: P) -> Result<MDBook>
[src]
Load a book from its root directory on disk.
pub fn load_with_config<P: Into<PathBuf>>(
book_root: P,
config: Config
) -> Result<MDBook>
[src]
book_root: P,
config: Config
) -> Result<MDBook>
Load a book from its root directory using a custom config.
pub fn load_with_config_and_summary<P: Into<PathBuf>>(
book_root: P,
config: Config,
summary: Summary
) -> Result<MDBook>
[src]
book_root: P,
config: Config,
summary: Summary
) -> Result<MDBook>
Load a book from its root directory using a custom config and a custom summary.
pub fn iter(&self) -> BookItems
[src]
Returns a flat depth-first iterator over the elements of the book,
it returns an BookItem enum:
(section: String, bookitem: &BookItem)
for item in book.iter() { match *item { BookItem::Chapter(ref chapter) => {}, BookItem::Separator => {}, BookItem::PartTitle(ref title) => {} } } // would print something like this: // 1. Chapter 1 // 1.1 Sub Chapter // 1.2 Sub Chapter // 2. Chapter 2 // // etc.
pub fn init<P: Into<PathBuf>>(book_root: P) -> BookBuilder
[src]
init()
gives you a BookBuilder
which you can use to setup a new book
and its accompanying directory structure.
The BookBuilder
creates some boilerplate files and directories to get
you started with your book.
book-test/
├── book
└── src
├── chapter_1.md
└── SUMMARY.md
It uses the path provided as the root directory for your book, then adds
in a src/
directory containing a SUMMARY.md
and chapter_1.md
file
to get you started.
pub fn build(&self) -> Result<()>
[src]
Tells the renderer to build our book and put it in the build directory.
pub fn execute_build_process(&self, renderer: &dyn Renderer) -> Result<()>
[src]
Run the entire build process for a particular Renderer
.
pub fn with_renderer<R: Renderer + 'static>(&mut self, renderer: R) -> &mut Self
[src]
You can change the default renderer to another one by using this method.
The only requirement is for your renderer to implement the Renderer
trait
pub fn with_preprocessor<P: Preprocessor + 'static>(
&mut self,
preprocessor: P
) -> &mut Self
[src]
&mut self,
preprocessor: P
) -> &mut Self
Register a Preprocessor
to be used when rendering the book.
pub fn test(&mut self, library_paths: Vec<&str>) -> Result<()>
[src]
Run rustdoc
tests on the book, linking against the provided libraries.
pub fn build_dir_for(&self, backend_name: &str) -> PathBuf
[src]
The logic for determining where a backend should put its build artefacts.
If there is only 1 renderer, put it in the directory pointed to by the
build.build_dir
key in Config
. If there is more than one then the
renderer gets its own directory within the main build dir.
i.e. If there were only one renderer (in this case, the HTML renderer):
- build/
- index.html
- ...
Otherwise if there are multiple:
- build/
- epub/
- my_awesome_book.epub
- html/
- index.html
- ...
- latex/
- my_awesome_book.tex
- epub/
pub fn source_dir(&self) -> PathBuf
[src]
Get the directory containing this book's source files.
pub fn theme_dir(&self) -> PathBuf
[src]
Get the directory containing the theme resources for the book.
Auto Trait Implementations
impl !RefUnwindSafe for MDBook
impl !Send for MDBook
impl !Sync for MDBook
impl Unpin for MDBook
impl !UnwindSafe for MDBook
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,