From 20bfcd128dfefd9645cdcb17dc024b3c4b8f45c6 Mon Sep 17 00:00:00 2001 From: Mathieu David Date: Thu, 6 Aug 2015 15:04:27 +0200 Subject: [PATCH] Fixed the code examples and added no_run to prevent them from running --- Cargo.toml | 3 +++ src/lib.rs | 20 +++++++++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index e675839d..44f49bfd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,6 +9,9 @@ handlebars = "*" rustc-serialize = "*" pulldown-cmark = "*" +[dev-dependencies] +tempdir = "*" + [features] default = ["output"] debug = [] diff --git a/src/lib.rs b/src/lib.rs index d4f0df31..6d1222ea 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -17,7 +17,7 @@ //! //! ## Example //! -//! ```ignore +//! ```no_run //! extern crate mdbook; //! //! use mdbook::MDBook; @@ -41,9 +41,23 @@ //! //! And then you can swap in your renderer like this: //! -//! ```ignore -//! let book = MDBook::new("my-book").set_renderer(your_renderer) +//! ```no_run +//! # extern crate mdbook; +//! # +//! # use mdbook::MDBook; +//! # use mdbook::renderer::HtmlHandlebars; +//! # use std::path::Path; +//! # +//! # fn main() { +//! # let your_renderer = HtmlHandlebars::new(); +//! # +//! let book = MDBook::new(Path::new("my-book")).set_renderer(Box::new(your_renderer)); +//! # } //! ``` +//! If you make a renderer, you get the book constructed in form of `Vec` and you get +//! the book config in a `BookConfig` struct. +//! +//! It's your responsability to create the necessary files in the correct directories. #[macro_use]