|
| 1 | +## Documentation (mdBook) |
| 2 | + |
| 3 | +This repository’s documentation is built using [**mdBook**](https://github.com/rust-lang-nursery/mdBook). |
| 4 | + |
| 5 | +Local builds and hosted builds use the same build script [1] to ensure consistent behavior. |
| 6 | + |
| 7 | +## Local documentation workflows |
| 8 | + |
| 9 | +All documentation targets **must be run from the repository root**. |
| 10 | + |
| 11 | +### Available Makefile targets |
| 12 | + |
| 13 | +```bash |
| 14 | +make docs # Build the mdBook locally using the shared build script |
| 15 | +make docs-serve # Serve the mdBook locally |
| 16 | +``` |
| 17 | + |
| 18 | +## Build script contract |
| 19 | + |
| 20 | +The documentation build is driven by: |
| 21 | + |
| 22 | +``` |
| 23 | +docs/book/install-and-build-mdbook.sh |
| 24 | +``` |
| 25 | + |
| 26 | +This script defines how mdBook is installed and executed. |
| 27 | + |
| 28 | +### Environment variables |
| 29 | + |
| 30 | +The build relies on the following environment variables: |
| 31 | + |
| 32 | +| Variable | Description | |
| 33 | +| ---------------- | -------------------------------- | |
| 34 | +| `GO_VERSION` | Go version used during the build | |
| 35 | +| `MDBOOK_VERSION` | mdBook version to install/use | |
| 36 | + |
| 37 | + |
| 38 | +## Version synchronization requirements |
| 39 | + |
| 40 | +The environment variables used for documentation builds must be kept **consistent across the repository**. |
| 41 | + |
| 42 | +When either `GO_VERSION` or `MDBOOK_VERSION` is changed, the update **must be applied in all of the following locations**: |
| 43 | + |
| 44 | +1. **Makefile** |
| 45 | + Used for local documentation builds and serving. |
| 46 | + |
| 47 | +2. **`netlify.toml`** |
| 48 | + Used for hosted and preview builds. |
| 49 | + |
| 50 | +3. **`docs/book/install-and-build-mdbook.sh`** |
| 51 | + Used as the canonical build script. |
| 52 | + |
| 53 | +## Editing documentation |
| 54 | + |
| 55 | +1. Make changes under: |
| 56 | + |
| 57 | + ``` |
| 58 | + docs/book/src/ |
| 59 | + ``` |
| 60 | +2. Preview changes locally: |
| 61 | + |
| 62 | + ```bash |
| 63 | + make docs-serve |
| 64 | + ``` |
| 65 | +3. Commit only source files; generated output is produced during the build. |
| 66 | + |
| 67 | +--- |
| 68 | + |
| 69 | +[1] [`docs/book/install-and-build-mdbook.sh`](book/install-and-build-mdbook.sh) |
| 70 | + |
0 commit comments