@@ -100,6 +100,7 @@ fn main() {
100
100
links_ignored_external : 0 ,
101
101
links_ignored_exception : 0 ,
102
102
intra_doc_exceptions : 0 ,
103
+ has_broken_urls : false ,
103
104
} ;
104
105
checker. walk ( & docs, & mut report) ;
105
106
report. report ( ) ;
@@ -116,6 +117,8 @@ struct Checker {
116
117
117
118
struct Report {
118
119
errors : u32 ,
120
+ // Used to provide help message to remind the user to register a page in `SUMMARY.md`.
121
+ has_broken_urls : bool ,
119
122
start : Instant ,
120
123
html_files : u32 ,
121
124
html_redirects : u32 ,
@@ -274,6 +277,7 @@ impl Checker {
274
277
report. links_ignored_exception += 1 ;
275
278
} else {
276
279
report. errors += 1 ;
280
+ report. has_broken_urls = true ;
277
281
println ! ( "{}:{}: broken link - `{}`" , pretty_path, i, target_pretty_path) ;
278
282
}
279
283
return ;
@@ -438,6 +442,13 @@ impl Report {
438
442
println ! ( "number of links ignored due to exceptions: {}" , self . links_ignored_exception) ;
439
443
println ! ( "number of intra doc links ignored: {}" , self . intra_doc_exceptions) ;
440
444
println ! ( "errors found: {}" , self . errors) ;
445
+
446
+ if self . has_broken_urls {
447
+ eprintln ! (
448
+ "NOTE: if you are adding or renaming a markdown file in a mdBook, don't forget to \
449
+ register the page in SUMMARY.md"
450
+ ) ;
451
+ }
441
452
}
442
453
}
443
454
0 commit comments