lychee icon indicating copy to clipboard operation
lychee copied to clipboard

Relative links aren't detected from STDIN or local files

Open nacnudus opened this issue 3 years ago • 2 comments

A similar issue was reported in #183 and addressed by #217. However, this doesn't work when files are passed into STDIN, or for local files.

lychee --dump --base https://www.example.com example.html # works
lychee --dump --base https://www.example.com example # doesn't work
cat example.html | lychee --dump --base https://www.example.com # doesn't work

Could this be fixed by having --base force HTML mode?

nacnudus avatar Jul 01 '22 01:07 nacnudus

That's a tricky one. I thought about assuming html input if --base was a valid URL, but Markdown files can also contain relative links and be prefixed with a URL. So that alone is not a decision criteria.

lychee has an internal file-type hint, that we could expose on the CLI, even though it sounds like a workaround. https://github.com/lycheeverse/lychee/blob/363b95fe5f748a72a452ed0a9748e3a3d7e8d783/lychee-lib/src/types/input.rs#L107-L116

I'm open for suggestions on how to make the file type explicit in an ergonomic way. Alternatively maybe I'm overlooking a possibility to make it work without any file type hints.

mre avatar Jul 01 '22 09:07 mre

Thank you for responding so quickly. I've attempted to address this issue in #673.

nacnudus avatar Jul 01 '22 17:07 nacnudus