Conversation
In #1485 it was requested to extract URLs from CSS files and inline styles. While lychee proper is generally becoming more conservative about the file types we support, the places where links can occur in CSS are pleasantly limited to `url()` directives (with the exception of inline URLs in `font-face` and `@import` rules, which we conveniently ignore for now). As such, integrating CSS support into lychee can be done by means of a simple extractor utilizing a bunch of regular expressions. It's not quite as exhaustive as a proper CSS parser (such as Servo's rust-cssparser crate), but on the plus side, we don't need to add additional dependencies. Fixes #1485
9b3f374 to
e80be51
Compare
Member
Author
|
I briefly considered adding SCSS/SASS file support as well, but decided against it. Mainly for the following reasons:
Besides, users can opt-in with |
Use top-level assert_eq for less code and better coverage
thomas-zahner
approved these changes
Dec 16, 2025
Member
thomas-zahner
left a comment
There was a problem hiding this comment.
I've added 5409ff9. Do you agree with that? It's less code and yields better coverage
Member
Author
Absolutely! I forgot we had that. Much better, thanks. |
Member
Author
|
AFAICT, the only open question is what we do with #1956 (comment). |
Member
|
I see no problems, so we're good to merge |
Member
Author
|
Thanks for the swift review. |
Closed
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In #1485 it was requested to extract URLs from CSS files and inline styles.
While lychee proper is generally becoming more conservative about the file types we support, the places where links can occur in CSS are pleasantly limited to
url()directives (with the exception of inline URLs infont-faceand@importrules, which we conveniently ignore for now).As such, integrating CSS support into lychee can be done by means of a simple extractor utilizing a bunch of regular expressions. It's not quite as exhaustive as a proper CSS parser (such as Servo's rust-cssparser crate), but on the plus side, we don't need to add additional dependencies.
Fixes #1485