-
-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add flag to force html mode #673
base: master
Are you sure you want to change the base?
Conversation
This is an attempt to address lycheeverse#671 by adding a flag `--html` to parse the input as HTML. Otherwise, STDIN and local files without the `.html` suffix are parsed as plain text.
Thanks for pushing this forward @nacnudus. Some questions:
We could also change the option to Alternatively, we could just add a section to the Looking forward to your thoughts. |
Hi, thanks for your reply, and apologies for my slowness responding.
Yes,
Imagemagick requires an image format specifier to read an APNG image sequence, otherwise it assumes that it is PNG and reads only the first frame.
I agree, that would be better.
That wouldn't work for STDIN, but perhaps lychee isn't the best tool for that any, because pipes can't benefit from lychee's multithreading, as far as I know. |
currently we relies on extension to determine the file format, and non supported format are treated as plaintext where we simply grab urls. this process is VERY inefficient due to the underlying implementation of linkify. instead, I think we can TRY to parse plaintext as html first, should that fail, we fallback to linkify. this is helpful given the most likely use case of lychee is to validate links in html rather than any other formats. |
I'm not sure if that's actually true. Most users use lychee-action and I wouldn't be surprised if the majority of links are checked in Markdown files.
Not sure if parsing HTML is faster, either. We'd have to run a benchmark to see if trying HTML first would give us any significant performance gains. |
plain text file are
doesn't apply to mark down files and as such
this is irrelevant. |
Parsing HTML is definitely faster than using linkify on normal sized html files. |
I like that. |
This is an attempt to address #671 by adding a flag
--html
to parsethe input as HTML. Otherwise, STDIN and local files without the
.html
suffix are parsed as plain text.