-
-
Notifications
You must be signed in to change notification settings - Fork 192
feat: add github markdown fragment quirk #1940
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
Conversation
Signed-off-by: Keming <kemingy94@gmail.com>
Signed-off-by: Keming <kemingy94@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds a new quirk to handle GitHub markdown blob URLs with fragments by converting them to raw GitHub URLs. This enables proper fragment checking by allowing lychee to parse the raw markdown content instead of the rendered HTML. The implementation updates the quirks system to pass regex captures to rewrite functions, enabling pattern-based URL transformations.
Key Changes:
- Updated quirk rewrite function signature to accept
Capturesparameter for pattern-based URL transformations - Added new
GITHUB_BLOB_MARKDOWN_FRAGMENT_PATTERNto match GitHub blob URLs with markdown fragments - Implemented URL rewrite logic to convert GitHub blob URLs to raw.githubusercontent.com URLs
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Keming <kemingy94@gmail.com>
|
@mre @kemingy Why is copilot starting to comment on this PR? 😩 I really hate this. For example it lies/hallucinates about things and provides an unnecessary summary that is bigger than the diff.. Can we disable it globally for the whole organisation? I thought we already did 😅 |
I'm not sure why From what I know, this can be configured in the |
| pattern: &GITHUB_BLOB_MARKDOWN_FRAGMENT_PATTERN, | ||
| rewrite: |mut request, captures| { | ||
| let mut raw_url = String::new(); | ||
| captures.expand( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a great solution 🚀
As discussed in #1729 (comment)