diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bba1a19a22..68a2dc0c28 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -11,6 +11,35 @@ of the print version. The snapshot files reflect what has been sent or not, so they only get updated when edits are sent to No Starch. **Do not submit pull requests changing files in the `nostarch` directory, they will be closed.** +We use [`rustfmt`][rustfmt] to apply standard formatting to Rust code in the +repo and [`dprint`][dprint] to apply standing formatting to the Markdown source +and the non-Rust code in the project. + +[rustfmt]: https://github.com/rust-lang/rustfmt +[dprint]: https://dprint.dev + +You will normally have `rustfmt` installed if you have a Rust toolchain +installed; if for some reason you do not have a copy of `rustfmt`, you can add +it by running the following command: + +```sh +rustup component add rustfmt +``` + +To install `dprint`, you can run the following command: + +```sh +cargo install dprint +``` + +Or follow the [instructions][install-dprint] on the `dprint` website. + +[install-dprint]: https://dprint.dev/install/ + +To format Rust code, you can run `rustfmt `, and to format other +files, you can pass `dprint `. Many text editors also have native +support or extensions for both `rustfmt` and `dprint`. + ## Checking for Fixes The book rides the Rust release trains. Therefore, if you see a problem on