Skip to content

Use mdbook-linkcheck to detect missing defs for ref-style links

Jim Newsome requested to merge jnewsome/torspec:ref-links into main

Suppose in raw markdown we have:

See [foo][barr].

[bar]: https://link-to-bar

The intent is to link the text "foo", but because of a typo it used the label barr instead of bar. The result is that the rendered html won't have a link at all. The text will be rendered literally as [foo][barr]. Since there's no link (not even a broken one), a link checker run over the rendered output won't spot the problem.

The mdbook-linkcheck plugin correctly detects this issue. However, it doesn't understand links that go between our two mdbook projects since the relative paths in the source don't match the relative paths in the rendered output. Since checking whether the links are non-broken is already covered by bin/check_links (using linklint), we can disable checking the link destinations altogether.

Adding a second output plugin (linkcheck) to mdbook adds an extra level of directories in the build output. We keep the previous final html layout by adding an intermediate mdbook build directory and copying from there to the desired layout.

Edited by Jim Newsome

Merge request reports

Loading