|
1 | | -#![cfg_attr(feature = "fatal-warnings", deny(warnings))] |
2 | | -// Note: If you change this remember to update `README.md`. To do so run `cargo run`. |
| 1 | +// Note: If you change this remember to update `README.md`. To do so run `cargo run`. |
3 | 2 | //! Cargo command to create your README from your crate’s documentation. |
4 | 3 | //! |
5 | 4 | //! # Installation |
|
8 | 7 | //! |
9 | 8 | //! # Usage |
10 | 9 | //! |
11 | | -//! Cargo rdme will insert your crate’s documentation in your README file. To control where the |
12 | | -//! documentation will be inserted you need to insert a marker: `<!-- cargo-rdme -->`. For example, |
| 10 | +//! Cargo rdme will insert your crate’s documentation in your README file. To control where the |
| 11 | +//! documentation will be inserted you need to insert a marker: `<!-- cargo-rdme -->`. For example, |
13 | 12 | //! you can start your README with some glorious badges and follow up with the rustdoc |
14 | 13 | //! documentation: |
15 | 14 | //! |
|
36 | 35 | //! |
37 | 36 | //! # Automatic transformations |
38 | 37 | //! |
39 | | -//! The documentation of your crate doesn’t always map directly to a good README. For example, |
40 | | -//! rust code blocks can have hidden lines. Those should not be shown in the README file. |
| 38 | +//! The documentation of your crate doesn’t always map directly to a good README. For example, |
| 39 | +//! rust code blocks can have hidden lines. Those should not be shown in the README file. |
41 | 40 | //! |
42 | 41 | //! This section covers the transformation cargo rdme automatically apply to generate a better |
43 | 42 | //! README. |
|
48 | 47 | //! |
49 | 48 | //! 1. Rust code blocks with lines starting with `#` will be omitted, just like in `rustdoc`. |
50 | 49 | //! 2. Rust code blocks get annotated with the `rust` markdown tag so it gets proper syntax |
51 | | -//! highlighting. We also remove tags that only concern `rustdoc` such as `should_panic`. |
| 50 | +//! highlighting. We also remove tags that only concern `rustdoc` such as `should_panic`. |
52 | 51 | //! |
53 | | -//! In the table below you can see an example of these modification. The code block now is |
| 52 | +//! In the table below you can see an example of these modification. The code block now is |
54 | 53 | //! tagged with `rust` and hidden lines were removed: |
55 | 54 | //! |
56 | 55 | //! <table border="1"> |
|
106 | 105 | //! Currently we only support links of the form `[⋯](crate::⋯)`, so be sure to use that format. |
107 | 106 | //! Links to the standard library are also supported, and they must be of the form |
108 | 107 | //! `[⋯](::<crate>::⋯)`, where `<crate>` is a crate that is part of the standard library, such as |
109 | | -//! `std`, `core`, or `alloc`. Reference-style links are also supported. |
| 108 | +//! `std`, `core`, or `alloc`. Reference-style links are also supported. |
110 | 109 | //! |
111 | 110 | //! Take a look at the example below: |
112 | 111 | //! |
|
138 | 137 | //! </tr> |
139 | 138 | //! </table> |
140 | 139 | //! |
141 | | -//! Note that there is some limitations in intralink support. This is a complex feature: cargo rdme |
142 | | -//! needs to do some work to be able to create the link to docs.rs. This is because the link |
| 140 | +//! Note that there is some limitations in intralink support. This is a complex feature: cargo rdme |
| 141 | +//! needs to do some work to be able to create the link to docs.rs. This is because the link |
143 | 142 | //! includes the kind of item the intralink points to, in the case of `is_prime` we need to discover |
144 | | -//! that is a function to generate a link that ends in `fn.is_prime.html`. Therefore, intralink |
| 143 | +//! that is a function to generate a link that ends in `fn.is_prime.html`. Therefore, intralink |
145 | 144 | //! support should be considered "best effort" (for instance, don’t expect items generated by macros |
146 | | -//! to be resolved). If cargo rdme is unable to generate the link it will still generate the README |
| 145 | +//! to be resolved). If cargo rdme is unable to generate the link it will still generate the README |
147 | 146 | //! file, but a warning will be emitted. |
148 | 147 | //! |
149 | 148 | //! ## Heading levels |
150 | 149 | //! |
151 | 150 | //! The heading levels in the crate’s documentation will, by default, be nested under the level |
152 | | -//! of the section of the README where it is inserted into. This behavior can be changed with |
| 151 | +//! of the section of the README where it is inserted into. This behavior can be changed with |
153 | 152 | //! the `--heading-base-level` command line flag, or in the configuration file (see example |
154 | 153 | //! below). |
155 | 154 | //! |
156 | 155 | //! # Configuration file |
157 | 156 | //! |
158 | 157 | //! If the default behavior of `cargo rdme` is not appropriate for your project you can crate a |
159 | | -//! configuration file `.cargo-rdme.toml` in the root of your project. This is how that |
| 158 | +//! configuration file `.cargo-rdme.toml` in the root of your project. This is how that |
160 | 159 | //! configuration file can look like: |
161 | 160 | //! |
162 | 161 | //! ```toml |
163 | | -//! # Override the README file path. When this is not set cargo rdme will use the file path defined |
| 162 | +//! # Override the README file path. When this is not set cargo rdme will use the file path defined |
164 | 163 | //! # in the project’s `Cargo.toml`. |
165 | 164 | //! readme-path = "MY-README.md" |
166 | 165 | //! |
167 | | -//! # What line terminator to use when generating the README file. This can be "lf" or "crlf". |
| 166 | +//! # What line terminator to use when generating the README file. This can be "lf" or "crlf". |
168 | 167 | //! line-terminator = "lf" |
169 | 168 | //! |
170 | 169 | //! # If you are using a workspace to hold multiple projects, use this to select the project from |
171 | | -//! # which to extract the documentation from. It can be useful to also set `readme-path` to create |
| 170 | +//! # which to extract the documentation from. It can be useful to also set `readme-path` to create |
172 | 171 | //! # the README file in the root of the project. |
173 | 172 | //! workspace-project = "subproject" |
174 | 173 | //! |
175 | 174 | //! # Defines the base heading level to use when inserting the crate’s documentation in the |
176 | | -//! # README. If this is not set the crate’s documentation will be inserted with its sections |
| 175 | +//! # README. If this is not set the crate’s documentation will be inserted with its sections |
177 | 176 | //! # belonging to the README section where the insertion happens. |
178 | 177 | //! heading-base-level = 0 |
179 | 178 | //! |
180 | | -//! # The default entrypoint will be `src/lib.rs`. You can change that in the `entrypoint` table. |
| 179 | +//! # The default entrypoint will be `src/lib.rs`. You can change that in the `entrypoint` table. |
181 | 180 | //! [entrypoint] |
182 | 181 | //! # The entrypoint type can be "lib" or "bin". |
183 | 182 | //! type = "bin" |
184 | | -//! # When you set type to "bin" the entrypoint default to `src/main.rs`. If you have binary targets |
| 183 | +//! # When you set type to "bin" the entrypoint default to `src/main.rs`. If you have binary targets |
185 | 184 | //! # specified in your cargo manifest you can select them by name with `bin-name`. |
186 | 185 | //! bin-name = "my-bin-name" |
187 | 186 | //! |
188 | 187 | //! [intralinks] |
189 | | -//! # Defines the base url to use in intralinks urls. The default value is `https://docs.rs`. |
| 188 | +//! # Defines the base url to use in intralinks urls. The default value is `https://docs.rs`. |
190 | 189 | //! docs-rs-base-url = "https://mydocs.rs" |
191 | | -//! # Defines the version to use in intralinks urls. The default value is `latest`. |
| 190 | +//! # Defines the version to use in intralinks urls. The default value is `latest`. |
192 | 191 | //! docs-rs-version = "1.0.0" |
193 | 192 | //! # If this is set the intralinks will be stripping in the README file. |
194 | 193 | //! strip-links = false |
195 | 194 | //! ``` |
196 | 195 | //! |
197 | | -//! These setting can be overridden with command line flags. Run `cargo rdme --help` for more |
| 196 | +//! These setting can be overridden with command line flags. Run `cargo rdme --help` for more |
198 | 197 | //! information. |
199 | 198 | //! |
200 | 199 | //! # Integration with CI |
201 | 200 | //! |
202 | 201 | //! To verify that your README is up to date with your crate’s documentation you can run |
203 | | -//! `cargo rdme --check`. The exit code will be `0` if the README is up to date, `3` if it’s |
| 202 | +//! `cargo rdme --check`. The exit code will be `0` if the README is up to date, `3` if it’s |
204 | 203 | //! not, or `4` if there were warnings. |
205 | 204 | //! |
206 | 205 | //! If you use GitHub Actions you can add this step to verify if the README is up to date: |
@@ -467,7 +466,7 @@ fn run(options: options::Options) -> Result<(), RunError> { |
467 | 466 | No marker found in the README file ({readme_filepath}). |
468 | 467 |
|
469 | 468 | cargo-rdme expects a marker in the README where the crate’s documentation will |
470 | | - be inserted. This is the marker you should add to your README: |
| 469 | + be inserted. This is the marker you should add to your README: |
471 | 470 |
|
472 | 471 | {marker}", |
473 | 472 | readme_filepath = readme_path.display(), |
|
0 commit comments