Skip to content

Commit 82ecd22

Browse files
Add the book update guide (#620)
* Update mdbook-open-on-gh version. 2.4.1 would crash during build locally. * Fix path to async_procs.md. * Add the guide to update the book. --------- Co-authored-by: Jacek Sieka <jacek@status.im>
1 parent ec3c85f commit 82ecd22

3 files changed

Lines changed: 60 additions & 2 deletions

File tree

.github/workflows/doc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
run: |
2727
cargo binstall mdbook@0.4.36 \
2828
mdbook-toc@0.14.1 \
29-
mdbook-open-on-gh@2.4.1 \
29+
mdbook-open-on-gh@2.4.3 \
3030
mdbook-admonish@1.14.0
3131
3232
- uses: jiro4989/setup-nim-action@v1

docs/src/SUMMARY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# User guide
55

66
- [Core concepts](./concepts.md)
7-
- [`async` functions](async_procs.md)
7+
- [`async` functions](./async_procs.md)
88
- [Errors and exceptions](./error_handling.md)
99
- [Threads](./threads.md)
1010
- [Tips, tricks and best practices](./tips.md)

docs/src/book.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
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

Comments
 (0)