Skip to content

Commit 7b9fa81

Browse files
chrissimpkinsmark-i-m
authored andcommitted
[README.md] add build instructions, link check config instructions, link check error documentation
1 parent e89d981 commit 7b9fa81

File tree

1 file changed

+62
-6
lines changed

1 file changed

+62
-6
lines changed

README.md

Lines changed: 62 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,73 @@ In general, when writing about a particular part of the compiler's code, we
3333
recommend that you link to the relevant parts of the [rustc
3434
rustdocs][rustdocs].
3535

36-
To help prevent accidentally introducing broken links, we use the
37-
`mdbook-linkcheck`. If installed on your machine `mdbook` will automatically
38-
invoke this link checker, otherwise it will emit a warning saying it couldn't
39-
be found.
36+
### Build Instructions
37+
38+
Deactivate the CI testing link validations by commenting out the `[output.linkcheck]` field in the `book.toml` configuration file like this:
39+
40+
```toml
41+
[book]
42+
title = "Guide to Rustc Development"
43+
author = "Rustc developers"
44+
description = "A guide to developing rustc"
45+
46+
[build]
47+
create-missing = false
48+
49+
[output.html]
50+
git-repository-url = "https://github.com/rust-lang/rustc-dev-guide"
51+
52+
[output.html.fold]
53+
enable = true
54+
level = 1
55+
56+
# [output.linkcheck]
57+
# follow-web-links = false
58+
# exclude = [ "crates\\.io", "gcc\\.godbolt\\.org", "youtube\\.com", "youtu\\.be", "dl\\.acm\\.org", "cs\\.bgu\\.ac\\.il" ]
59+
# cache-timeout = 172800
60+
# warning-policy = "error"
61+
```
62+
63+
These validations can cause errors during local builds (see Link Validations section below). Please **do not** commit these `book.toml` file changes when you submit a pull request.
64+
65+
To build a local static HTML site, install [`mdbook`](https://github.com/rust-lang/mdBook) with:
66+
67+
```
68+
> cargo install mdbook
69+
```
70+
71+
and execute the following command in the root of the repository:
72+
73+
```
74+
> mdbook build
75+
```
76+
77+
The build files are found in the `book` directory.
78+
79+
### Link Validations
80+
81+
We use `mdbook-linkcheck` to validate URLs included in our documentation. To perform link checks, uncomment the `[output.linkcheck]` field in the `book.toml` configuration file and install `mdbook-linkcheck` with:
4082

4183
```bash
4284
> cargo install mdbook-linkcheck
4385
```
4486

45-
You will need `mdbook` version `>= 0.3.5` and `mdbook-linkcheck` version `>= 0.5`.
46-
`linkcheck` will be run automatically when you run `mdbook build`.
87+
You will need `mdbook` version `>= 0.3.5` and `mdbook-linkcheck` version `>= 0.5` to check links.
88+
`linkcheck` will be run automatically when you build with the instructions in the section above.
89+
90+
**Please note**: You may receive errors like the following when link checks are active on local `mdbook` builds:
91+
92+
```
93+
error: The server responded with 429 Too Many Requests for "https://github.com/rust-lang/rust/tree/master/src/tools/compiletest"
94+
95+
┌── tests/intro.md:6:1 ───
96+
97+
6 │ [`src/tools/compiletest`] directory). This section gives a brief
98+
│ ^ Server responded with 429 Too Many Requests
99+
```
100+
101+
There is not a workaround for this error at the moment. Comment out the `[output.linkcheck]` field in the `book.toml` using the build instructions above to complete a local site build without link validations.
102+
47103

48104
## How to fix toolstate failures
49105

0 commit comments

Comments
 (0)