Skip to content

Commit

Permalink
feat: check URL fragments
Browse files Browse the repository at this point in the history
This implements URL fragment checking. Parsing is expanded to also
collect values of all `id` attributes.

For missing fragments in files a `CheckError::Anchor` will be returned
containing a path and the missing fragment.

In Rust documentation non-existent fragments in the form of `#n-m` is
used to highlight a range of lines in the source code. For fragments in
that form additional check is performed to test if all fragments `n`
through `m` exist. In case of missing items in a ranged fragment
`CheckError::AnchorRange` will be returned containing a path, the
missing ranged fragment, and missing item from the range.

Bare in mind that this introduces overhead of performing n+1 parsing or
fetching via HTTP. This is because multiple links pointing to the same
URL with different fragments end up fetching/parsing the same content
for each fragment. To help with that fragment caching is using
memoization using cached crate.

Fixes #7
  • Loading branch information
zregvart committed Nov 11, 2020
1 parent 1240c7a commit c4a106b
Show file tree
Hide file tree
Showing 9 changed files with 713 additions and 19 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@

* If a URL points to a directory, check if index.html exists in that directory. [PR#90]
* Treat absolute paths as absolute with respect to the `base_url`, not with respect to the file system. [PR#91]
* Check link fragments, with special handling for Rustdoc ranged fragments to highlight source code lines [PR#94]

[PR#90]: https://github.com/deadlinks/cargo-deadlinks/pull/90
[PR#91]: https://github.com/deadlinks/cargo-deadlinks/pull/91
[PR#94]: https://github.com/deadlinks/cargo-deadlinks/pull/94

#### Fixes

Expand Down
Loading

0 comments on commit c4a106b

Please sign in to comment.