2015-07-30 11:59:08 +02:00
|
|
|
# The build command
|
|
|
|
|
|
|
|
|
|
The build command is used to render your book:
|
|
|
|
|
|
2015-12-29 17:59:08 -05:00
|
|
|
```bash
|
2015-07-30 11:59:08 +02:00
|
|
|
mdbook build
|
|
|
|
|
```
|
|
|
|
|
|
2018-08-02 21:34:26 -05:00
|
|
|
It will try to parse your `SUMMARY.md` file to understand the structure of your
|
|
|
|
|
book and fetch the corresponding files.
|
2015-07-30 11:59:08 +02:00
|
|
|
|
2015-09-24 22:19:14 +02:00
|
|
|
The rendered output will maintain the same directory structure as the source for
|
2015-07-30 11:59:08 +02:00
|
|
|
convenience. Large books will therefore remain structured when rendered.
|
|
|
|
|
|
|
|
|
|
#### Specify a directory
|
|
|
|
|
|
2018-08-02 16:52:54 -05:00
|
|
|
The `build` command can take a directory as an argument to use as the book's
|
|
|
|
|
root instead of the current working directory.
|
2015-07-30 11:59:08 +02:00
|
|
|
|
2015-12-29 17:59:08 -05:00
|
|
|
```bash
|
2015-07-30 11:59:08 +02:00
|
|
|
mdbook build path/to/book
|
|
|
|
|
```
|
|
|
|
|
|
2017-01-01 09:42:47 -08:00
|
|
|
#### --open
|
|
|
|
|
|
2018-08-02 16:52:54 -05:00
|
|
|
When you use the `--open` (`-o`) flag, mdbook will open the rendered book in
|
2017-01-01 09:42:47 -08:00
|
|
|
your default web browser after building it.
|
|
|
|
|
|
2017-01-17 00:11:39 +00:00
|
|
|
#### --dest-dir
|
|
|
|
|
|
2018-08-02 21:34:26 -05:00
|
|
|
The `--dest-dir` (`-d`) option allows you to change the output directory for the
|
|
|
|
|
book. If not specified it will default to the value of the `build.build-dir` key
|
|
|
|
|
in `book.toml`, or to `./book` relative to the book's root directory.
|
2017-01-17 00:11:39 +00:00
|
|
|
|
2015-07-30 11:59:08 +02:00
|
|
|
-------------------
|
|
|
|
|
|
2018-08-02 21:34:26 -05:00
|
|
|
***Note:*** *Make sure to run the build command in the root directory and not in
|
|
|
|
|
the source directory*
|