Skip to content

Commit 75dac15

Browse files
Fixed a couple issues with the docs
1 parent 5041359 commit 75dac15

File tree

3 files changed

+30
-19
lines changed

3 files changed

+30
-19
lines changed

src/book/init.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ impl BookBuilder {
6161
/// - Create a `.gitignore` (if applicable)
6262
/// - Create a themes directory and populate it (if applicable)
6363
/// - Generate a `book.toml` file,
64-
/// - Then load the book so we can
64+
/// - Then load the book so we can build it or run tests.
6565
pub fn build(&self) -> Result<MDBook> {
6666
info!("Creating a new book with stub content");
6767

@@ -146,6 +146,10 @@ impl BookBuilder {
146146
fn build_gitignore(&self) -> Result<()> {
147147
debug!("[*]: Creating .gitignore");
148148

149+
let mut f = File::create(self.root.join(".gitignore"))?;
150+
151+
writeln!(f, "{}", self.config.build.build_dir.display())?;
152+
149153
Ok(())
150154
}
151155

src/book/summary.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ use errors::*;
1313
/// # Summary Format
1414
///
1515
/// **Title:** It's common practice to begin with a title, generally
16-
/// "# Summary". But it is not mandatory, the parser just ignores it. So you
17-
/// can too if you feel like it.
16+
/// "# Summary". It's not mandatory and the parser (currently) ignores it, so
17+
/// you can too if you feel like it.
1818
///
1919
/// **Prefix Chapter:** Before the main numbered chapters you can add a couple
2020
/// of elements that will not be numbered. This is useful for forewords,
@@ -35,7 +35,8 @@ use errors::*;
3535
/// - [Title of the Chapter](relative/path/to/markdown.md)
3636
/// ```
3737
///
38-
/// You can either use - or * to indicate a numbered chapter.
38+
/// You can either use - or * to indicate a numbered chapter, the parser doesn't
39+
/// care but you'll probably want to stay consistent.
3940
///
4041
/// **Suffix Chapter:** After the numbered chapters you can add a couple of
4142
/// non-numbered chapters. They are the same as prefix chapters but come after
@@ -125,7 +126,7 @@ impl From<Link> for SummaryItem {
125126
}
126127
}
127128

128-
/// A recursive descent parser for a `SUMMARY.md`.
129+
/// A recursive descent (-ish) parser for a `SUMMARY.md`.
129130
///
130131
///
131132
/// # Grammar
@@ -203,6 +204,8 @@ impl<'a> SummaryParser<'a> {
203204
}
204205
}
205206

207+
/// Get the current line and column to give the user more useful error
208+
/// messages.
206209
fn current_location(&self) -> (usize, usize) {
207210
let byte_offset = self.stream.get_offset();
208211

@@ -459,7 +462,6 @@ fn get_last_link(links: &mut [SummaryItem]) -> Result<(usize, &mut Link)> {
459462
})
460463
}
461464

462-
463465
/// Removes the styling from a list of Markdown events and returns just the
464466
/// plain text.
465467
fn stringify_events(events: Vec<Event>) -> String {
@@ -712,4 +714,4 @@ mod tests {
712714

713715
assert_eq!(got, should_be);
714716
}
715-
}
717+
}

src/lib.rs

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
//! # mdBook
22
//!
3-
//! **mdBook** is similar to Gitbook but implemented in Rust.
3+
//! **mdBook** is similar to GitBook but implemented in Rust.
44
//! It offers a command line interface, but can also be used as a regular crate.
55
//!
6-
//! This is the API doc, but you can find a [less "low-level" documentation here](../index.html)
7-
//! that contains information about the command line tool, format, structure etc.
8-
//! It is also rendered with mdBook to showcase the features and default theme.
6+
//! This is the API doc, the [user guide] is also available if you want
7+
//! information about the command line tool, format, structure etc. It is also
8+
//! rendered with mdBook to showcase the features and default theme.
99
//!
1010
//! Some reasons why you would want to use the crate (over the cli):
1111
//!
@@ -52,8 +52,9 @@
5252
//!
5353
//! ## Implementing a new Renderer
5454
//!
55-
//! If you want to create a new renderer for mdBook, the only thing you have to do is to implement
56-
//! the [Renderer trait](renderer/renderer/trait.Renderer.html)
55+
//! If you want to create a new renderer for mdBook, the only thing you have to
56+
//! do is to implement the [Renderer](renderer/renderer/trait.Renderer.html)
57+
//! trait.
5758
//!
5859
//! And then you can swap in your renderer like this:
5960
//!
@@ -71,22 +72,26 @@
7172
//! book.set_renderer(your_renderer);
7273
//! # }
7374
//! ```
74-
//! If you make a renderer, you get the book constructed in form of `Vec<BookItems>` and you get
75-
//! the book config in a `BookConfig` struct.
7675
//!
77-
//! It's your responsability to create the necessary files in the correct directories.
76+
//! If you make a renderer, you get the book constructed in form of
77+
//! `Vec<BookItems>` and you get ! the book config in a `BookConfig` struct.
78+
//!
79+
//! It's your responsability to create the necessary files in the correct
80+
//! directories.
7881
//!
7982
//! ## utils
8083
//!
81-
//! I have regrouped some useful functions in the [utils](utils/index.html) module, like the
82-
//! following function [`utils::fs::create_file(path:
83-
//! &Path)`](utils/fs/fn.create_file.html)
84+
//! I have regrouped some useful functions in the [utils](utils/index.html)
85+
//! module, like the following function [`utils::fs::create_file(path:
86+
//! &Path)`](utils/fs/fn.create_file.html).
8487
//!
8588
//! This function creates a file and returns it. But before creating the file
8689
//! it checks every directory in the path to see if it exists, and if it does
8790
//! not it will be created.
8891
//!
8992
//! Make sure to take a look at it.
93+
//!
94+
//! [user guide]: https://rust-lang-nursery.github.io/mdBook/
9095
9196
#[macro_use]
9297
extern crate error_chain;

0 commit comments

Comments
 (0)