microsoft/openvmm
Publicmirrored fromhttps://github.com/microsoft/openvmmAvailable
Guide/src/dev_guide/contrib/guide.md
92lines · modecode
| 1 | # Updating this Guide |
| 2 | |
| 3 | We gladly welcome PRs that improve the quality of the OpenVMM guide! |
| 4 | |
| 5 | The OpenVMM Guide is written in Markdown, and rendered to HTML using |
| 6 | [mdbook](https://github.com/rust-lang/mdBook). You can find the source-code of |
| 7 | this Guide in the main OpenVMM GitHub repo, in the |
| 8 | [`Guide/`](https://github.com/microsoft/openvmm/tree/main/Guide) folder. |
| 9 | |
| 10 | ## Guide conventions |
| 11 | |
| 12 | * Line Length: Wrap lines at 80 characters. |
| 13 | |
| 14 | ## Editing the Guide |
| 15 | |
| 16 | ### Small Changes |
| 17 | |
| 18 | For small changes, you can simply click the "Suggest an Edit" button in the |
| 19 | top-right corner of any page to automatically open up a GitHub Edit page. |
| 20 | |
| 21 | ### Medium Changes |
| 22 | |
| 23 | For medium changes, we suggest cloning the repo locally, and previewing changes |
| 24 | to Markdown in your editor (Visual Studio Code has good support for this). |
| 25 | |
| 26 | ### Large Changes |
| 27 | |
| 28 | For large changes, we suggest cloning the repo locally, and building a fully |
| 29 | rendered copy of the Guide using `mdbook`. |
| 30 | |
| 31 | This is very useful when making changes that leverage mdbook preprocessors, such |
| 32 | as using mermaid diagrams, or previewing admonishments. |
| 33 | |
| 34 | ```admonish info |
| 35 | For example, the `mdbook-admonish` preprocessor is what powers this nice looking |
| 36 | "Info" box! |
| 37 | ``` |
| 38 | |
| 39 | Building the Guide locally is quite straightforward: |
| 40 | |
| 41 | 1. Install `mdbook` and the additional preprocessors we use locally: |
| 42 | |
| 43 | ```bash |
| 44 | cargo install mdbook |
| 45 | cargo install mdbook-admonish |
| 46 | cargo install mdbook-mermaid |
| 47 | ``` |
| 48 | |
| 49 | 2. Navigate into the `Guide/` directory, and run `mdbook`: |
| 50 | |
| 51 | ```bash |
| 52 | cd Guide/ |
| 53 | # must be run inside the `Guide/` directory! |
| 54 | mdbook serve |
| 55 | ``` |
| 56 | |
| 57 | 3. Navigate to the localhost URL in your web browser (typically |
| 58 | `http://127.0.0.1:3000/`) |
| 59 | |
| 60 | ### Troubleshooting |
| 61 | |
| 62 | #### Running `mdbook serve` outside the `Guide/` directory |
| 63 | |
| 64 | **Error:** |
| 65 | |
| 66 | ``` |
| 67 | 2024-10-29 16:26:22 [INFO] (mdbook::book): Book building has started |
| 68 | error: manifest path `./mdbook-openvmm-shim/Cargo.toml` does not exist |
| 69 | ``` |
| 70 | |
| 71 | **Solution:** |
| 72 | |
| 73 | Ensure you have changed your working-directory to the `Guide/` folder (e.g: via |
| 74 | `cd Guide/`), and then run `mdbook serve`. |
| 75 | |
| 76 | #### Rust is not installed |
| 77 | |
| 78 | **Error:** |
| 79 | |
| 80 | ``` |
| 81 | 2024-10-29 16:35:49 [INFO] (mdbook::book): Book building has started |
| 82 | 2024-10-29 16:35:49 [WARN] (mdbook::preprocess::cmd): The command wasn't found, is the "admonish" preprocessor installed? |
| 83 | 2024-10-29 16:35:49 [WARN] (mdbook::preprocess::cmd): Command: cargo run --quiet --manifest-path ./mdbook-openvmm-shim/Cargo.toml mdbook-admonish |
| 84 | ``` |
| 85 | |
| 86 | **Solution:** |
| 87 | |
| 88 | The OpenVMM Guide hooks into a custom Rust utility called `mdbook-openvmm-shim`, |
| 89 | which must be compiled in order for `mdbook` to successfully build the OpenVMM |
| 90 | guide. |
| 91 | |
| 92 | Please ensure you have [installed Rust](../getting_started/linux.md#installing-rust). |
| 93 | |