benbalter / jekyll-relative-links

A Jekyll plugin to convert relative links to markdown files to their rendered equivalents
MIT License
142 stars 37 forks source link

Support relative links pointing outside of the Jekyll site? #73

Open hugovdm opened 3 years ago

hugovdm commented 3 years ago

Problem

We have Markdown documentation for a software project. Let's call the repo directory "repo". The /docs directory in this project is served via GitHub Pages, so repo/docs/index.md is served as $user.github.io/repo/index.html

For local use and viewed on GitHub, index.md could link to source code, or other content outside of docs/: index.md could link to "../src/main.cc" for example. Currently this rewrites to $user.github.io/src/index.html

I'd love to be able to configure a Jekyll plugin to rewrite relative links that point at the parent of docs/, to rather point at https://github.com/$user/repo/tree/master or https://github.com/$user/repo/tree/$selected_release_tag

Preferred solution

I'd love to configure Jeyll Relative Links to indicate what URL I wish it to consider to be the parent of docs/ - perhaps if I tell it the parent of docs/ should be considered to be http://example.com/foo/bar/baz/, it could even handle grandparent (.../foo/bar/) or great-grandparent (.../foo/) of docs.

Alternative solution