Commit 5dae27a
authored
Rollup merge of rust-lang#83237 - notriddle:short-links, r=jyn514
rustdoc: use more precise relative URLs
This is a fairly large diff, and will probably conflict with rust-lang#82815 since it reduces (but does not eliminate) the use of the old depth variable.
Instead of using a depth counter and adding "../" to get to the top, this commit makes rustdoc actually compare the path of what it's linking from to the path that it's linking to. This makes the resulting HTML shorter.
Here's a comparison of one of the largest (non-source) files in the Rust standard library docs (about 4% improvement before gzipping).
$ wc -c struct.Wrapping.old.html struct.Wrapping.new.html
2387389 struct.Wrapping.old.html
2298538 struct.Wrapping.new.html
Most if it can be efficiently gzipped away.
$ wc -c struct.Wrapping.old.html.gz struct.Wrapping.new.html.gz
70679 struct.Wrapping.old.html.gz
70050 struct.Wrapping.new.html.gz
But it also makes a difference in the final DOM size, reducing it from 91MiB to 82MiB.File tree
46 files changed
+576
-547
lines changed- src
- librustdoc
- clean
- html
- render
- test/rustdoc
- auxiliary
- intra-doc-crate
- intra-doc
- cross-crate
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
46 files changed
+576
-547
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
| |||
193 | 194 | | |
194 | 195 | | |
195 | 196 | | |
196 | | - | |
| 197 | + | |
197 | 198 | | |
198 | | - | |
199 | 199 | | |
200 | | - | |
| 200 | + | |
201 | 201 | | |
202 | 202 | | |
203 | 203 | | |
204 | 204 | | |
205 | | - | |
| 205 | + | |
206 | 206 | | |
207 | 207 | | |
208 | | - | |
| 208 | + | |
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
| |||
219 | 219 | | |
220 | 220 | | |
221 | 221 | | |
| 222 | + | |
| 223 | + | |
222 | 224 | | |
| 225 | + | |
223 | 226 | | |
224 | | - | |
| 227 | + | |
225 | 228 | | |
226 | | - | |
227 | | - | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
228 | 239 | | |
229 | | - | |
230 | 240 | | |
231 | | - | |
| 241 | + | |
232 | 242 | | |
233 | 243 | | |
234 | 244 | | |
| |||
238 | 248 | | |
239 | 249 | | |
240 | 250 | | |
241 | | - | |
| 251 | + | |
242 | 252 | | |
243 | | - | |
244 | 253 | | |
245 | 254 | | |
246 | 255 | | |
| |||
0 commit comments