From a0040733e9a68cabd89eb1e5035943d86d38a242 Mon Sep 17 00:00:00 2001 From: Mathieu David Date: Thu, 6 Aug 2015 14:09:55 +0200 Subject: [PATCH] Fixed rust example in doc + some tweaks for html validation --- book-example/src/lib/lib.md | 11 ++++++----- src/renderer/html_handlebars/helpers/toc.rs | 2 +- src/theme/index.hbs | 4 ++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/book-example/src/lib/lib.md b/book-example/src/lib/lib.md index 51b6115f..91724e3d 100644 --- a/book-example/src/lib/lib.md +++ b/book-example/src/lib/lib.md @@ -8,13 +8,14 @@ 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("my-book") // Path to root - .set_src("src") // Path from root to source directory - .set_dest("book") // Path from root to output directory - .read_config() // Parse book.json file for configuration + 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 + book.build().unwrap(); // Render the book } ``` diff --git a/src/renderer/html_handlebars/helpers/toc.rs b/src/renderer/html_handlebars/helpers/toc.rs index 9d924086..e2d9ba24 100644 --- a/src/renderer/html_handlebars/helpers/toc.rs +++ b/src/renderer/html_handlebars/helpers/toc.rs @@ -66,7 +66,7 @@ impl HelperDef for RenderToc { try!(rc.writer.write("\"".as_bytes())); if path == ¤t { - try!(rc.writer.write("class=\"active\"".as_bytes())); + try!(rc.writer.write(" class=\"active\"".as_bytes())); } try!(rc.writer.write(">".as_bytes())); diff --git a/src/theme/index.hbs b/src/theme/index.hbs index 6aaa724e..d53c49fb 100644 --- a/src/theme/index.hbs +++ b/src/theme/index.hbs @@ -7,10 +7,10 @@ - + - +