Skip to content

Commit c5fa185

Browse files
committed
update docs
1 parent 259ecfb commit c5fa185

File tree

6 files changed

+46
-30
lines changed

6 files changed

+46
-30
lines changed

book-example/src/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
# mdBook
22

3-
**mdBook** is a command line tool and Rust library to create books using Markdown. It's very similar to Gitbook but written in [Rust](http://www.rust-lang.org).
3+
**mdBook** is a command line tool and Rust crate to create books using Markdown files. It's very similar to Gitbook but written in [Rust](http://www.rust-lang.org).
44

5-
This book serves as an example of the output of mdBook and as the docs at the same time.
5+
What you are reading serves as an example of the output of mdBook and at the same time as high-level docs.
66

77
mdBook is free and open source, you can find the source code on [Github](https://github.com/azerupi/mdBook). Issues and feature requests can be posted on the [Github Issue tracker](https://github.com/azerupi/mdBook/issues).
88

99
## API docs
1010

1111
Alongside this book you can also read the [API docs](mdbook/index.html) generated by Rustdoc if you would like
12-
to use mdBook as a crate or write a new renderer.
12+
to use mdBook as a crate or write a new renderer and need a more low-level overview.
1313

1414
## License
1515

16-
mdBook, all the code and this book, are released under the [Mozilla Public License v2.0](https://www.mozilla.org/MPL/2.0/)
16+
mdBook, all the source code, is released under the [Mozilla Public License v2.0](https://www.mozilla.org/MPL/2.0/)

book-example/src/cli/build.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ mdbook build
99
It will try to parse your `SUMMARY.md` file to understand the structure of your book
1010
and fetch the corresponding files.
1111

12-
The rendered ouput will maintain the same directory structure as the source for
12+
The rendered output will maintain the same directory structure as the source for
1313
convenience. Large books will therefore remain structured when rendered.
1414

1515
#### Specify a directory
1616

17-
Like init, the build command can take a directory as argument to use instead of the
17+
Like `init`, the `build` command can take a directory as argument to use instead of the
1818
current working directory.
1919

2020
```

book-example/src/cli/cli-tool.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,21 @@
11
# Command Line Tool
22

3-
mdBook can be used either as a command line tool or a Rust library.
3+
mdBook can be used either as a command line tool or a [Rust crate](https://crates.io/crates/mdbook).
44
Let's focus on the command line tool capabilities first.
5+
6+
## Install
7+
8+
At the moment, the only way to install mdBook is by downloading the source code from Github and building it yourself. Fortunately
9+
this is made very easy with Cargo.
10+
11+
If you haven't already, you should begin by installing [Rust](https://www.rust-lang.org/install.html) and [Git](https://git-scm.com/downloads)
12+
13+
Open your terminal and navigate to the directory of you choice. We need to clone the git repository and then build it with Cargo.
14+
15+
```
16+
git clone --depth=1 https://github.com/azerupi/mdBook.git
17+
cd mdBook
18+
cargo build --release
19+
```
20+
21+
The executable `mdbook` will be in the `./target/release` folder, this should be added to the path.

book-example/src/cli/init.md

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
# The init command
22

3-
The init command, used like this:
3+
The `init` command is used like this:
44

55
```
66
mdbook init
77
```
88

9-
Will create a couple of files and directories in the working directory so that you can
9+
It will create a couple of files and directories in the working directory so that you can
1010
spend more time writing your book and less setting it up.
1111

1212
The files set up for you are the following:
13+
1314
```
1415
book-test/
1516
├── book
@@ -22,14 +23,15 @@ The `src` directory is were you write your book in markdown. It contains all the
2223
configuration files, etc.
2324

2425
The `book` directory is where your book is rendered. All the output is ready to be uploaded
25-
to a serer to be seen by the internet.
26+
to a server to be seen by the internet.
27+
28+
The `SUMMARY.md` file is the most important file, it's the skeleton of your book and is discussed in more detail in another [chapter](../format/summary.html).
2629

27-
The `SUMMARY.md` file is the most important file, it's the skeleton of your book.
28-
It's so important that it has it's own [chapter](../format/summary.html).
30+
When a `SUMMARY.md` file already exists, the `init` command will generate the files according to the paths used in the `SUMMARY.md`
2931

3032
#### Specify a directory
3133

32-
When using the init command, you can also specify a directory, instead of using the current directory,
34+
When using the `init` command, you can also specify a directory, instead of using the current working directory,
3335
by appending a path to the command:
3436

3537
```
@@ -43,10 +45,3 @@ called `theme` in your source directory so that you can modify it.
4345

4446
The theme is selectively overwritten, this means that if you don't want to overwrite a
4547
specific file, just delete it and the default file will be used.
46-
47-
## Not yet implemented
48-
49-
In the future I would like `mdBook init` to be able to:
50-
51-
- Generate files that are in `SUMMARY.md`. If the user has already created a `SUMMARY.md` file and added some entries but did
52-
not create the corresponding files, init command should create the files for him.

book-example/src/format/summary.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,19 @@ allow for easy parsing. Let's see how you should format your `SUMMARY.md` file.
1414
But it is not mandatory, the parser just ignores it. So you can too
1515
if you feel like it.
1616

17-
2. ***list link*** the other elements have to be list elements in form of a link
17+
2. ***Prefix Chapter*** Before the main numbered chapters you can add a couple of elements that will not be numbered. This is useful for
18+
forewords, introductions, etc. There are however some constraints. You can not nest prefix chapters, they should all be on the root level. And you can not add prefix chapters once you have added numbered chapters.
1819
```markdown
19-
- [Title of the Chapter](relative/path/to/markdown.md)
20+
[Title of prefix element](relative/path/to/markdown.md)
2021
```
21-
You can either use `-` or `*` to indicate a list. The lists can be nested,
22-
resulting in a nice hierarchy (chapters, sub-chapters, etc.)
2322

24-
All other elements are unsupported and will be ignored at best or result in an error.
23+
3. ***Numbered Chapter*** Numbered chapters are the main content of the book, they will be numbered and can be nested,
24+
resulting in a nice hierarchy (chapters, sub-chapters, etc.)
25+
```markdown
26+
- [Title of the Chapter](relative/path/to/markdown.md)
27+
```
28+
You can either use `-` or `*` to indicate a numbered chapter.
2529

26-
#### not yet implemented
30+
4. ***Sufix Chapter*** After the numbered chapters you can add a couple of non-numbered chapters. They are the same as prefix chapters but come after the numbered chapters instead of before.
2731

28-
In the feature I would like to add support for links without the need to be list elements
29-
at the root level to add chapters that don't need numbering, like an index, appendix,
30-
contributor list, introduction, foreword, etc.
32+
All other elements are unsupported and will be ignored at best or result in an error.

book-example/src/format/theme/theme.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ Here are the files you can overwrite:
1111

1212
- ***index.hbs*** is the handlebars template.
1313
- ***book.css*** is the style used in the output. If you want to change the design of your book, this is probably the file you want to modify. Sometimes in conjunction with `index.hbs` when you want to radically change the layout.
14-
- ***book.js*** is mostly used to add client side functionality.
14+
- ***book.js*** is mostly used to add client side functionality, like hiding / un-hiding the sidebar, changing the theme, ...
15+
- ***highlight.js*** is the JavaScript that is used to highlight code snippets, you should not need to modify this.
16+
- ***highlight.css*** is the theme used for the code highlighting
1517

1618
***Note:*** *When you overwrite a file, it is possible that you break some functionality. Therefore I recommend to use the file from the default theme as template and only add / modify what you need. You can copy the default theme into your source directory automatically by using `mdbook init --theme`.*

0 commit comments

Comments
 (0)