|
| 1 | +# Updating this book |
| 2 | + |
| 3 | +To contribute to this book, [fork the repository](https://github.com/status-im/nim-chronos/fork), edit the book locally, and [send a pull request](https://github.com/status-im/nim-chronos/compare) with your changes. |
| 4 | + |
| 5 | +## Modifying the content |
| 6 | + |
| 7 | +The book's content is stored in the form of `.md` files in `docs/src` directory. For example, this page's source is at `docs/src/book.md`. |
| 8 | + |
| 9 | +To edit the content, you'll need any text editor and familiarity with [Markdown](https://rust-lang.github.io/mdBook/format/markdown.html) syntax. |
| 10 | + |
| 11 | +If you want to add a new page, edit the file `docs/src/SUMMARY.md`. It's a list of all pages in this book, groupped into parts: |
| 12 | + |
| 13 | +```markdown |
| 14 | +- [Introduction](./introduction.md) |
| 15 | +- [Examples](./examples.md) |
| 16 | + |
| 17 | +# User guide |
| 18 | + |
| 19 | +- [Core concepts](./concepts.md) |
| 20 | +- [`async` functions](./async_procs.md) |
| 21 | +- [Errors and exceptions](./error_handling.md) |
| 22 | +- [Threads](./threads.md) |
| 23 | +- [Tips, tricks and best practices](./tips.md) |
| 24 | +- [Porting code to `chronos`](./porting.md) |
| 25 | +- [HTTP server middleware](./http_server_middleware.md) |
| 26 | + |
| 27 | +# Developer guide |
| 28 | + |
| 29 | +- [Updating this book](./book.md) |
| 30 | +``` |
| 31 | + |
| 32 | +If mdBook detects a new page in `SUMMARY.md` that doesn't have a corresponding `.md` file, it will create it automatically during next build and you'll be able to edit it as any other page. |
| 33 | + |
| 34 | +## Building the docs locally |
| 35 | + |
| 36 | +This book is created using [mdBook](https://rust-lang.github.io/mdBook/) so to test your changes locally, you'll need to have it along with preprocessors installed. |
| 37 | + |
| 38 | +If you have a working Rust toolchain set up, install the cargo crates with `cargo install`: |
| 39 | + |
| 40 | +```shell |
| 41 | +cargo install mdbook@0.4.36 mdbook-toc@0.14.1 mdbook-open-on-gh@2.4.3 mdbook-admonish@0.14.0 |
| 42 | +``` |
| 43 | + |
| 44 | +If you don't have it, the easiest way to install mdBook without installing Rust is to use [cargo-binstall](https://github.com/cargo-bins/cargo-binstall): |
| 45 | + |
| 46 | +```shell |
| 47 | +cargo-binstall mdbook@0.4.36 mdbook-toc@0.14.1 mdbook-open-on-gh@2.4.3 mdbook-admonish@0.14.0 |
| 48 | +``` |
| 49 | + |
| 50 | +After that, you can build and view the docs locally with this command: |
| 51 | + |
| 52 | +```shell |
| 53 | +mdbook serve --hostname:0.0.0.0 docs |
| 54 | +``` |
| 55 | + |
| 56 | +Open [localhost:3000](http://localhost:3000) your browser to see the docs. |
| 57 | + |
| 58 | +`mdbook serve` automatically detects changes in the docs sources, rebuilds the site, and refreshes the page in the browser to show the new version. |
0 commit comments