-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Use relative links and translate internal references #603
Conversation
It would be nice to have internal links conversions ... I just was looking for this in the documentation, a simple way to link internal pages, if I link with .html we lose repository navigation, if I link with .md we lose web navigation :( |
What state is this issue in? Is it still waiting for reviews? It would be helpful to write relative markdown links instead of directly links to HTML. If this feature works with #685, the behavior would be more consistent accorss GitHub/Bitbucket and some other website. As @cetra3 mentioned above, no more 404 page and README.md is served as index file. |
@weihanglo yep, still waiting for a review. As there have been some changes to the master I may need to re-cut this, if the appetite is there. |
I was initially a little hesitant about introducing the breaking change and complicating the It's a breaking change though, so we may need to put together a quick link rewriting script to make migration easier. The Book uses Sorry for leaving this so long @cetra3! Are you still interested in completing this PR? |
Yes. Definitely |
@cetra3 awesome! It should hopefully be easy enough to Looking through the PR, to translate from absolute links to relative links we'll need to:
Did I miss anything from that list? If there's anything we can do to help, please let us know! |
I will see how easy it is to rebase rather than resubmit it. Should there be some sort of migration path for existing projects? |
I'm not sure. When this lands we'll do a major version bump and post something to both the user forums and |
Is here anything that I can help? |
@weihanglo It's a WIP on a local branch. I'm just doing a few tests to get it to work with the new version. |
@Michael-F-Bryan it's now basically rebased from the current master, so no merge conflicts. Had to adjust a couple more tests as they were failing. |
@weihanglo you can install this PR via cargo with:
|
What are the next steps before this can be merged? |
I am just waiting for @Michael-F-Bryan to take it from here and get the changes merged. |
Sorry for the long wait @cetra3, I've been busy with work and not really had any time for my personal projects. I checked this out locally and as far as I can tell there aren't any issues. Great work! |
* Relative links for 0.1.8 * Compat for IE11 search
So this PR is a breaking change. This converts everything to a relative URL, and also resolves internal links, solving #408.
This does two things:
Making all the links relative within the output html
Currently the html output relies heavily on the
<base href
for links. This PR basically removes this from the template, and converts all links to relative, adding in the appropriatepath_to_root
variable.Removing this has the following benefits:
http://example.com/book/
.Converting internal links from
.md
to.html
This is the second part of the change, and does break the internal structure of some books, but fixes #408.
As an example in the
book-example
dir on the init.md page, the following link:Is now changed to:
This has the following benefits:
SUMMARY.md
.