Conversation
Let all the anchors id on the print page to have a path id prefix to help locate. e.g. bar/foo.md#abc -> #bar-foo-abc Also append a dummy div to the start of the original page to make sure that original page links without an anchor can also be located. Fix to remove all the `./` in the normalized path id so that for "./foo/bar.html#abc" we still get "#foo-bar-abc" Add support for redirect link anchors in print page so that anchors can also be redirected, also handle URL redirect links on print page Handle all the elements id to add a path prefix, also make path id to all be the lower case Fix for print page footnote links by adding the path id prefix Signed-off-by: Hollow Man <hollowman@opensuse.org>
I experienced a problem with links starting with / for example: introduction.html gets converted into #-introduction instead of #introduction, fixed by remove the first character incase the link starts with /
|
nevermind, some links still don't work |
|
absolute links of subpages seem to not work |
absolute links of subpages seem to not work so for example, all links inside a page like "tutorial/guide.html" seem to append "tutorial" so instead of being "#setup" it becomes "#tutorial-setup" fixed by only appending base of links that don't start with / my solution may be bad and I didn't test it thouroughly but it works for me
|
this commit should fix it, but like pointed out, I can't guarantee that it works properly and doesn't break other behaviour. |
2d8cf8a to
4073892
Compare
|
Hi @scrythe! Good catch. Thanks for pointing this out and submitting this PR. I didn't really expect those links within the book to be absolute, as I can also observe some problems when I directly open the html with browser. I implemented my fix for this here: https://github.com/rust-lang/mdBook/compare/cef21f1927d8cef0253836011a68f307355d59e6..bc18556e2ca2b200ae5a2305573ec35bbe707b4e Then I tried to compile the book https://github.com/bevy-cheatbook/bevy-cheatbook, and it looks like we have another issue: those pages actually don't exist in Thanks again, and I'm closing this now. Feel free to discuss with me if you find more issues at rust-lang#1738 |

I experienced a problem with links starting with /
for example: introduction.html gets converted into #-introduction instead of #introduction, fixed by remove the first character incase the link starts with /
I tested the new version on bevy-cheatbook (https://github.com/bevy-cheatbook/bevy-cheatbook) and it seems to work for me.