False positive on some hash links
I noticed false positive reportings on these URLs:
* [`https://github.com/gjtorikian/html-proofer/issues/854#issuecomment-3049287310`](https://github.com/gjtorikian/html-proofer/issues/854#issuecomment-3049287310)
* [`https://kafka.apache.org/30/documentation/streams/developer-guide/dsl-api.html#tumbling-time-windows`](https://kafka.apache.org/30/documentation/streams/developer-guide/dsl-api.html#tumbling-time-windows)
html-proofer reports the links failed, because the hash does not exist, although it actually exists. For the first case, it is an id on a `div`, while for the second case, it is an id on an empty `a` element.
For reproduciblility, I run everything in Docker:
```sh
docker run -it ruby:3.4 bash
```
The following results in an error:
```
# gem install html-proofer
# htmlproofer --as-links https://kafka.apache.org/30/documentation/streams/developer-guide/dsl-api.html#tumbling-time-windows
Running 1 check (LinkCheck) on ["https://kafka.apache.org/30/documentation/streams/developer-guide/dsl-api.html#tumbling-time-windows"] ...
Checking 1 external link
For the Links > External check, the following failures were found:
* External link https://kafka.apache.org/30/documentation/streams/developer-guide/dsl-api.html#tumbling-time-windows failed: https://kafka.apache.org/30/documentation/streams/developer-guide/dsl-api.html exists, but the hash 'tumbling-time-windows' does not (status code 200)
HTML-Proofer found 1 failure!
```
For reference, the link to `https://github.com/gjtorikian/html-proofer?tab=readme-ov-file#configuration` does work.
```
# htmlproofer --as-links https://github.com/gjtorikian/html-proofer?tab=readme-ov-file#configuration
Running 1 check (LinkCheck) on ["https://github.com/gjtorikian/html-proofer?tab=readme-ov-file#configuration"] ...
Checking 1 external link
HTML-Proofer finished successfully.
Finished in 0.61 seconds
```
关闭于 2025-07-16 5 条评论