question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support relative file URIs in hyperlinks when using CLI

See original GitHub issue

For example when converting the following html to a pdf, it should be possible to make the hyperlink refer to the relative URI and not the absolute URI:

<a href="external-file.pdf">File</a>

What I get: “file://absolute-path/external-file.pdf” What I want: “external-file.pdf”

I have tried to change the --base-url argument, but it does not remove the absolute path if I set it to “”(empty).

So I looked it up in the code, and it is fairly easy to change, but I just wanted to make sure that there is interest in including this feature. If there are indeed interest I can make a pull request.

Relative file URIs are also what Prince outputs by default.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
W4RH4WKcommented, Aug 29, 2022

Alright. This is currently not high on my priority list. When I come around to this, I might checkout the code and see whether I can come up with something that is viable. I’ll open an issue / PR as necessary.

Thank you for the information.

1reaction
liZecommented, Aug 29, 2022

However, style sheets are no longer found:

Of course, they’re not found because there’s no base-url.

Handling your use case is not as easy as it looks. Even if we add a new option (something like keep-local-anchors), I think that it will be really hard to find a behavior that satisfies everyone.

If you want to get this feature, you can open a new issue so that we can discuss your use case and find a way to solve it in a quite flexible way. I can’t promise that it will be implemented, as the current behavior is already quite complex (even if it’s easy to use in easy cases, as explained above).

Read more comments on GitHub >

github_iconTop Results From Across the Web

File Uri Scheme and Relative Files - Stack Overflow
If you want to use full URI, you must tell a root relative to which your relative path is: <a href="file:///home/kindrik/./.bashrc">link</a>.
Read more >
cli hyperlinks — links • cli
Because file: hyperlinks must contain an absolute path, cli tries to convert relative paths, and paths starting with ~ to aboslute path.
Read more >
HTML and URLs
HTML documents utilize URLs for specifying hypertext links. The following provides a brief ... Relative URLs are resolved to full URLs using a...
Read more >
13. Hyper Links URL Paths. Absolute Path vs Relative Path for ...
In this video we will see about the Hyperlink URL and paths. Difference between the Absolute URLs and the Relative URL for adding...
Read more >
HTML File Paths | Absolute vs Relative URLs - YouTube
No one likes a broken link which is why this video on File Paths - Absolute and Relative Path URL's is so important....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found