Skip to content
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

registry: try to replace relative paths in README images #500

Merged
merged 2 commits into from
Oct 19, 2023
Merged

Conversation

vrmiguel
Copy link
Member

@vrmiguel vrmiguel commented Oct 19, 2023

Link for the testbed for this feature

Given a README that links to an image through a relative path to its repository, this PR introduces logic to fetch a URL for the same image that pgt.dev could use to render the image correctly

Example:
![Citus Banner](images/citus-readme-banner.png) becomes ![Citus Banner](https://raw.githubusercontent.com/citusdata/citus/main/images/citus-readme-banner.png)

@aws-amplify-us-east-1
Copy link

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-500.dwcnpr7p8u1tw.amplifyapp.com


if let Ok((_, image)) = parse_markdown_image(remaining) {
// We're only interested in relative paths, so if we parsed a URL, skip it
if image.path_or_link.starts_with("http") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job catching this case - lots of repos will have urls like this: https://github.com/DarrenBaldwin07/DarrenBaldwin07/assets/68653294/a53fce84-b120-489d-a795-12be94e67641

@vrmiguel vrmiguel merged commit 9cccc83 into main Oct 19, 2023
5 checks passed
@vrmiguel vrmiguel deleted the tem-1951 branch October 19, 2023 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants