Support relative file URIs in hyperlinks when using CLI
See original GitHub issueFor 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:
- Created 6 years ago
- Reactions:1
- Comments:8 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
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).