lychee icon indicating copy to clipboard operation
lychee copied to clipboard

How should lychee treat empty-string `href` values?

Open SKalt opened this issue 4 months ago • 0 comments

Context

If I'm writing markdown

[this website]()

that gets compiled to html

<a href="">this website</a>

the href's value is the page's address. However, an empty href is also a red flag: the author probably didn't mean to leave those links empty. lychee currently interprets each empty link as a check if the current document can be reached, which it always can be.

Reproduction

mkdir -p /tmp/empty_href
echo "[this website]()" > /tmp/empty_href/example.md
echo '<html><body><a href="">this website</a></body></html>' > /tmp/empty_href/example.html
lychee -vv /tmp/empty_href/

Desired behavior

An empty_link = "warn" # or "ok" or "error" configuration option would preserve the current technically-correct link-checking behavior while giving users information about suspicious links and a way to opt into more rigorous checking.

SKalt avatar Oct 16 '24 12:10 SKalt