-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Markdown links always server absolute #1201
Comments
@NGPixel Is there any plan to fix this bug? I imported my old wiki, all files are in |
Relative links in Markdown do work, but there's definitely some weirdness. Though my experience is only with 2.x. Weirdness in 2.x: say I'm editing a page at The latter makes more more sense, imo, for a relative link. The editor preview pane should behave the same as the rendered page. |
yep I also just ran into this, relative links will work in the preview pane of the editor but not on the actual page. relative links dont work at all for images. this is an annoyance because the git synchronisation makes it so easy to work with content from within vim/emacs/atom but then on the page the links are broken. |
This same problem also persists with linked pictures which reduces the portability of the markdown files greatly. |
This is my experience with v2 as well. In v1, all my relative markdown links rendered correctly in HTML, so this seems like a pretty serious regression. The only thing that fixes this is to convert all relative links into absolute links, e.g.
If the contents of
then an incorrect link to If I change
this renders the link correctly as However, this solution isn't very portable, and since it's a regression from v1, all relative links need to be transformed before v2 is usable for me. @NGPixel I see you labeled this as a bug back in 2019. Do you think the most likely outcome is to not support relative paths going forward, or is this something that you would like to see fixed given enough time and development resources? Maybe that's a silly question to ask, but I'm trying to gauge whether I should bite the bullet and convert all my markdown links, or, since I'm not in a rush to migrate to v2, give this issue some more time to soak. Thanks! |
Wiki.js v2 does not work correctly with relative URLs in markdown (see requarks/wiki#1201). As a workaround for this issue, we can convert all relative URLs to absolute ones. This is not a portable solution (e.g. if we ever serve the wiki content from a subdirectory), but it should enable us to switch seamlessly between Wiki.js v1 and v2 as we decide which version we want to run.
One of the great feats of wiki.js is that there is theoretically almost no lock-in when you stick with markdown and make use of the great backup features. This is basically the only issue that gives me headaches regarding portability. Some more advanced markdown features are different across platforms and "flavors", but how to make links is supposed to be agreed upon, see https://spec.commonmark.org/0.29/#links — anything that handles links differently from putting what's in the parentheses into the resulting link tag's In the worst case, a link like I understand that some wikis have been built with this behavior already and it would be painful to migrate them to a different default behavior. Yet if wikijs would offer a "classic link rendering" option or the like, the problem could probably be mitigated? |
Describe the bug
It seems impossible to create relative links in markdown:
Current URL:
http://localhost/this-doc
Markdown code
[other doc in same folder](other-doc)
Rendered target URL:
http://localhost/this-doc/other-doc
To Reproduce
Steps to reproduce the behavior:
Expected behavior
It should be possible to use relative links to avoid having to type paths
The text was updated successfully, but these errors were encountered: