Skip to content
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

relativepath=true and _sidebar.md can't coexist #1761

Closed
1 task
hamishwillee opened this issue Feb 27, 2022 · 1 comment
Closed
1 task

relativepath=true and _sidebar.md can't coexist #1761

hamishwillee opened this issue Feb 27, 2022 · 1 comment

Comments

@hamishwillee
Copy link

hamishwillee commented Feb 27, 2022

Bug Report

  • Relative links with relativepath = false don't work as people would reasonably expect.
  • Sidebars only work if if paths are set to absolute If they are relative, then the sidebar link is appended to the current page path - which won't work except in the root page.

Steps to reproduce

Any site with a sidebar that uses
https://docsify.js.org/#/configuration?id=relativepath

What is current behaviour

Relative paths are generally useful in documentation, because they allow you to write that something is in the same current folder, without having to qualify the full path, or is at some position relative to the current path (e.g. down one level). In particular this means that a multilingual sites easier, because the the path doesn't need to be changed for each translation.

Further, if you use relative link syntax in your markdown, people expect it to behave in a certain way because every file manager and web browser interprets the relative path syntax in the same way. Specifically: "../" always means go down one level, "/" always means "from the root", and no preceding path always means "relative to the current folder". When relativepath is set to false, you get completely weird and unexpected behaviour that does not obey these conventions.

The reason this is a problem is that it is good to have relative paths working as expected, but if you do this then it is impossible to use a sidebar. This is because that is also relative to the current page. So that same sidebar which worked for all links on the first page will work for none of them on any other page (because the path is appended to the current page).

What is the expected behaviour

The standard syntax for markdown paths should be respected, as per every other system in the world. If a link is ../ it should always be treated as relative to the current page. It would only be absolute if the path is prefixed by /.

Minimally, the only other way this might work is if the sidebar was fixed to be "absolute".

Other relevant information

  • Bug does still occur when all/other plugins are disabled?

All of these are irrelevant, though I guess since relativepath=true was supported

  • Your OS: Windows Windows 11
  • Node.js version: 12.13.0
  • npm/yarn version: [email protected]
  • Browser version: Any (tested latest chrome and Firefox)
  • Docsify version: 4
  • Docsify plugins: Doesn't matter.

Please create a reproducible sandbox

I don't understand how to get this sandbox editor to work.
Edit 307qqv236

Mention the docsify version in which this bug was not present (if any)

Whenever

@jhildenbiddle
Copy link
Member

Bug acknowledged. Tracking with #1891.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants