about summary refs log tree commit diff
path: root/src/tools/linkchecker
AgeCommit message (Collapse)AuthorLines
2025-09-08fix partial urlencoded link supportnixxo-12/+16
- added full urlencoding to properly check urlencoded anchor links against non-urlencoded heading IDs - added tests urlecoding provided by https://crates.io/crates/urlencoding
2025-07-28add --link-targets-dir flag to linkcheckerPietro Albini-25/+52
2025-07-28add an argument parser to linkcheckerPietro Albini-5/+46
2025-07-28bump linkchecker to edition 2024Pietro Albini-1/+1
2025-06-20fix(linkcheck): Build using the lockfileEd Page-0/+1
This is to unblock cargo from servo/html5ever#623
2025-03-13bump html5ever to 0.29 with depsklensy-1/+1
2025-03-13bump html5ever to 0.28klensy-13/+13
see https://github.com/servo/html5ever/pull/548
2025-01-11Add bstr files to linkchecker since they have a Deref to sliceJosh Triplett-0/+23
The Deref brings in the documentation from slice, so it has the same issue as slice.
2024-12-30chore: fix typosHoru-1/+1
2024-10-15linkchecker: add a reminder on broken links to add new/renamed pages to ↵许杰友 Jieyou Xu (Joe)-0/+11
SUMMARY.md for mdBooks
2024-08-24update the doc comment on lintchecker b/c it parses html nowbinarycat-2/+4
2024-07-29Reformat `use` declarations.Nicholas Nethercote-6/+6
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-05add `new_range_api` for RFC 3550Peter Jaszkowiak-0/+2
This includes a `From<legacy::RangeInclusive> for RangeInclusive` impl for convenience, instead of the `TryFrom` impl from the RFC. Having `From` is highly convenient and the assertion is unlikely to be a problem in practice. This includes re-exports of all existing `Range` types under `core::range`, plus the range-related traits (`RangeBounds`, `Step`, `OneSidedRange`) and the `Bound` enum. Currently the iterators are just wrappers around the old range types, and most other trait impls delegate to the old rage types as well. Also includes an `.iter()` shorthand for `.clone().into_iter()`
2024-06-15fix build with html5ever bumpklensy-1/+1
2024-06-15bump few depsklensy-1/+1
2024-04-28Remove direct dependencies on lazy_static, once_cell and byteorderGeorge Bateman-6/+7
The functionality of all three crates is now available in the standard library.
2024-02-08Switch linkchecker to use html5ever for html parsing.Eric Huss-194/+232
The existing regex-based HTML parsing was just too primitive to correctly handle HTML content. Some books have legitimate `href="…"` text which should not be validated because it is part of the text, not actual HTML.
2024-02-08Add test for broken_intra_doc_link.Eric Huss-0/+13
2023-08-06linkchecker: Remove unneeded FIXME about intra-doc linksMartin Nordholts-1/+0
It was added by 77971 but the adder proposed in that PR that the added code is a good fallback to have in case rustdoc gets buggy, and I agree. So remove the FIXME.
2023-05-14Appease lintsLucasFA-19/+16
A warning about an unnecessary drop used to appear when running the linkchecker. Also some clippy warnings
2023-04-20linkchecker: running from a directory separate from the bookWeihang Lo-8/+18
Since rust-lang/cargo#11851, Cargo became a Cargo workspace of itself. However, since `src/tools/linkchecker` cannot run inside a workspace, Cargo needs a workaround that excludes `src/doc` from workspace member probing. To remove this hack, this PR adds a new optional argument `--path` for `linkchecker.sh`. With this new argument, `linkchecker.sh` can be run from a directory separate from the book. This also benefits other projects using linkchecker, as they can run it under target directory or any other directory, reducing leftover.
2022-11-03Remove reference from the intra-doc link checker.Eric Huss-24/+10
2022-11-03Move intra-doc link checks to a separate function.Eric Huss-6/+17
2022-08-29Ignore mailto links in linkcheckerJethro Beekman-0/+1
2022-07-25Fix some broken link fragments.Eric Huss-5/+0
2022-03-09Also take in account mdbook redirect in linkcheckerLoïc BRANSTETT-7/+13
2022-02-11linkchecker: fix panic on directory symlinksSimon Chopin-2/+3
In Debian and Ubuntu, there are some patches that change the rustc/fonts directory to a symlink to the system fonts. This triggers a latent bug in linkchecker, as the DirEntry filetype isn't a dir but later on the file itself, when opened, is one, triggering an unreachable!() clause. This patch fixes the situation by using std::fs::metadata, which goes through symlinks. I'd have added a test case but `tidy` doesn't seem to like symlinks, and moreover I'm not sure how Git deals with symlinks on Windows. Signed-off-by: Simon Chopin <simon.chopin@canonical.com>
2021-10-22docs: Escape brackets to satisfy the linkcheckerNoah Lev-0/+2
My change to use `Type::def_id()` (formerly `Type::def_id_full()`) in more places caused some docs to show up that used to be missed by rustdoc. Those docs contained unescaped square brackets, which triggered linkcheck errors. This commit escapes the square brackets and adds this particular instance to the linkcheck exception list.
2021-09-20Migrate to 2021Mark Rousskov-1/+1
2021-09-12Fix linkcheck issuesJoshua Nelson-0/+26
Most of these are because alloc uses `#[lang_item]` to define methods, but core documents primitives before those methods are available. - Fix rustdoc-js-std test For some reason this change made CStr not show up in the results for `str,u8`. Since it still shows up for str, and since it wasn't a great match for that query anyway, I think this is ok to let slide. - Add test that all primitives can be linked to - Enable `doc(primitive)` in `core` as well - Add linkcheck exception specifically for Windows Ideally this would be done automatically by the linkchecker by replacing `\\` with forward slashes, but this PR is already a ton of work ... - Don't forcibly fail linkchecking if there's a broken intra-doc link on Windows Previously, it would exit with a hard error if a missing file had `::` in it. This changes it to report a missing file instead, which allows adding an exception.
2021-08-06Fix typo -- "The" -> "They"await Marsha-1/+1
I was reading through source code to try to learn more about the language and how to make the most of it when I ran into a small typo, so I figured I'd offer up a fix! I'm pretty new now, but hopefully I can offer up more substantial changes later. :D
2021-07-29rfc3052: Remove authors field from Cargo manifestsJade-1/+0
Since RFC 3052 soft deprecated the authors field anyway, hiding it from crates.io, docs.rs, and making Cargo not add it by default, and it is not generally up to date/useful information, we should remove it from crates in this repo.
2021-06-09linkchecker: Fix bug where fragment errors printed the wrong path.Eric Huss-2/+3
2021-06-09Change the linkchecker self-tests to validate more output.Eric Huss-7/+42
2021-06-08Fix linkchecker redirection tests.Eric Huss-0/+4
These were changed in #84703.
2021-06-03Build linkcheck script as release to run faster.Eric Huss-1/+1
2021-06-03Fix linkcheck script from getting out of sync.Eric Huss-4/+4
2021-06-01Replace h3 and h4 containing invalid DOMGuillaume Gomez-1/+1
2021-05-24Add some tests for the linkchecker.Eric Huss-0/+187
2021-05-24Optimize linkchecker by caching all filesystem access.Eric Huss-172/+214
This should improve performance 2-3x depending on the system.
2021-05-22linkchecker: Organize state into a struct, and add report.Eric Huss-208/+257
Moves all the state into a struct so it doesn't need to be passed around as much. Also adds a report showing how long it took and what it found. This includes a minor change: a failure to load a file is now an error, instead of being ignored. This should only happen if there is a permission error or some other shenanigans going on.
2021-04-04Bump cfgsMark Rousskov-2/+0
2021-03-10remove slice linkcheck exceptionsFrançois Mockers-5/+0
2021-02-09Stabilize str_split_onceJacob Pratt-1/+1
2021-01-17Remove unused linkcheck exceptionsJoshua Nelson-10/+1
2020-12-07Dogfood 'str_split_once() with linkcheckerEric Arellano-5/+8
2020-10-18Set `MDBOOK_OUTPUT__HTML__INPUT_404` on linkcheckerYuki Okushi-0/+3
2020-10-15Deny broken intra-doc links in linkcheckerJoshua Nelson-0/+66
Since rustdoc isn't warning about these links, check for them manually.
2020-09-13Ignore rustc_private items from std docsLzu Tao-0/+10
Apply suggestions from code review Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-09-04Auto merge of #75207 - dylni:add-slice-check-range, r=KodrAusbors-0/+1
Add `slice::check_range` This method is useful for [`RangeBounds`] parameters. It's even been [rewritten](https://github.com/rust-lang/rust/blob/22ee68dc586440f96b76b32fbd6087507c6afdb9/src/librustc_data_structures/sorted_map.rs#L214) [many](https://github.com/rust-lang/rust/blob/22ee68dc586440f96b76b32fbd6087507c6afdb9/library/alloc/src/vec.rs#L1299) [times](https://github.com/rust-lang/rust/blob/22ee68dc586440f96b76b32fbd6087507c6afdb9/library/core/src/slice/mod.rs#L2441) in the standard library, sometimes assuming that the bounds won't be [`usize::MAX`]. For example, [`Vec::drain`] creates an empty iterator when [`usize::MAX`] is used as an inclusive end bound: ```rust assert!(vec![1].drain(..=usize::max_value()).eq(iter::empty())); ``` If this PR is merged, I'll create another to use it for those methods. [`RangeBounds`]: https://doc.rust-lang.org/std/ops/trait.RangeBounds.html [`usize::MAX`]: https://doc.rust-lang.org/std/primitive.usize.html#associatedconstant.MAX [`Vec::drain`]: https://doc.rust-lang.org/std/vec/struct.Vec.html#method.drain