You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you click on any of the "Subchapter" chapters, you will cycle between the correct chapter (which loads because you start the website from the top-level directory from which relative links are valid) and 404 (if you are not in the top-level directory and you try to use any links in {{#toc}}{{/toc}}).
Possible Solution(s)
Revert to the old behavior. If that isn't feasible, at least mark this breaking change in the changelog.
Notes
mdBook version v0.4.14>= used to use {{#toc}}{{/toc}} to generate the sidebar, so it had to handle subdirectories and relative links gracefully.
mdBook version v0.4.35<= switched to toc.js/toc.html mechanism which replaced {{#toc}}{{/toc}}. {{#toc}}{{/toc}} still handled subdirectories and relative links well (like previous versions).
Newer versions (I have tested v0.4.43 and v0.4.48) suffer from the issue described here (they always use relative links relative to top-level directory even in subdirectories).
Version
v0.4.48
The text was updated successfully, but these errors were encountered:
Uh oh!
There was an error while loading. Please reload this page.
Problem
Note
The issue described here may be considered invalid usage of mdBook. I chose to make an issue about it because:
The
{{#toc}}{{/toc}}
toc helper uses relative paths to refer to each chapter. Such links do not work when they aren't in the top level directory.This is a regression, because mdBook v0.4.35<= (I haven't bisected the exact version) used to handle this gracefully.
Steps
The following shell script creates a default mdBook which uses
{{#toc}}{{/toc}}
to handle the sidebar.If you click on any of the "Subchapter" chapters, you will cycle between the correct chapter (which loads because you start the website from the top-level directory from which relative links are valid) and 404 (if you are not in the top-level directory and you try to use any links in
{{#toc}}{{/toc}}
).Possible Solution(s)
Revert to the old behavior. If that isn't feasible, at least mark this breaking change in the changelog.
Notes
mdBook version v0.4.14>= used to use
{{#toc}}{{/toc}}
to generate the sidebar, so it had to handle subdirectories and relative links gracefully.mdBook version v0.4.35<= switched to
toc.js
/toc.html
mechanism which replaced{{#toc}}{{/toc}}
.{{#toc}}{{/toc}}
still handled subdirectories and relative links well (like previous versions).Newer versions (I have tested v0.4.43 and v0.4.48) suffer from the issue described here (they always use relative links relative to top-level directory even in subdirectories).
Version
The text was updated successfully, but these errors were encountered: