| 1 |
# The build command |
| 2 |
|
| 3 |
The build command is used to render your book: |
| 4 |
|
| 5 |
```bash |
| 6 |
mdbook build |
| 7 |
``` |
| 8 |
|
| 9 |
It will try to parse your `SUMMARY.md` file to understand the structure of your |
| 10 |
book and fetch the corresponding files. Note that this will also create files |
| 11 |
mentioned in `SUMMARY.md` which are not yet present. |
| 12 |
|
| 13 |
The rendered output will maintain the same directory structure as the source for |
| 14 |
convenience. Large books will therefore remain structured when rendered. |
| 15 |
|
| 16 |
#### Specify a directory |
| 17 |
|
| 18 |
The `build` command can take a directory as an argument to use as the book's |
| 19 |
root instead of the current working directory. |
| 20 |
|
| 21 |
```bash |
| 22 |
mdbook build path/to/book |
| 23 |
``` |
| 24 |
|
| 25 |
#### `--open` |
| 26 |
|
| 27 |
When you use the `--open` (`-o`) flag, mdbook will open the rendered book in |
| 28 |
your default web browser after building it. |
| 29 |
|
| 30 |
#### `--dest-dir` |
| 31 |
|
| 32 |
The `--dest-dir` (`-d`) option allows you to change the output directory for the |
| 33 |
book. Relative paths are interpreted relative to the current directory. If |
| 34 |
not specified it will default to the value of the `build.build-dir` key in |
| 35 |
`book.toml`, or to `./book`. |
| 36 |
|
| 37 |
------------------- |
| 38 |
|
| 39 |
***Note:*** *The build command copies all files (excluding files with `.md` extension) from the source directory |
| 40 |
into the build directory.* |