Skip to content

Relative links in readme fixed#36

Open
hRupanjan wants to merge 5 commits intopastelsky:mainfrom
hRupanjan:main
Open

Relative links in readme fixed#36
hRupanjan wants to merge 5 commits intopastelsky:mainfrom
hRupanjan:main

Conversation

@hRupanjan
Copy link

@hRupanjan hRupanjan commented Jan 6, 2024

This PR solves the bug mentioned in the issue #9

It handles all type of relative links in a readme file viz.

  1. (../../CONTRIBUTING.md)
  2. (CONTRIBUTING.md)
  3. (./CONTRIBUTING.md)
  4. srcset="./logo.svg"

I have tested for possible test cases. But, consider testing it more.

Packages that I have tested on: @primer/react, lit

* Relative Link Fix

* Multiple Fixes for Relative Link handling
throw new Error("Compile error");
}

await updateReadmeRelativeLinks(
Copy link
Owner

Choose a reason for hiding this comment

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

We'd also need to do this as a post-load script.

The updateReadmeRelativeLinks would only work for newly generated docs.

Copy link
Author

@hRupanjan hRupanjan Jan 16, 2024

Choose a reason for hiding this comment

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

Yes. Currently it only works for newly generated docs.

Copy link
Author

Choose a reason for hiding this comment

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

@pastelsky what do you mean by a post-load script?

Copy link
Author

Choose a reason for hiding this comment

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

@pastelsky need some discussion on this

- moving utility functions to the respective file
- some optimisations for relative path replacement function
@hRupanjan hRupanjan changed the title Relative links in readme fixed (#9) Relative links in readme fixed Jan 21, 2024
@hRupanjan hRupanjan requested a review from pastelsky January 21, 2024 17:29
@difosfor
Copy link

Thanks for you work! I'd love to see this feature, but as I also pointed out in the related issue, I think relative links should link to files next to the originating one, so inside the same published NPM package, not within it's repo.

-- #9 (comment)

@hRupanjan
Copy link
Author

You are welcome 😊. I did mention the issues in the main issue thread.

import { CachedPackageInfo, InstallPackageOptions, VersionData } from "./types";
import { config } from "dotenv";

config({
Copy link

Choose a reason for hiding this comment

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

Test comment

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.

4 participants