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

Embedded files doesn't resolve relative links #865

Closed
1 task done
aenniw opened this issue Jun 8, 2019 · 11 comments · Fixed by #867
Closed
1 task done

Embedded files doesn't resolve relative links #865

aenniw opened this issue Jun 8, 2019 · 11 comments · Fixed by #867
Labels
bug confirmed as a bug path-resolving

Comments

@aenniw
Copy link
Contributor

aenniw commented Jun 8, 2019

Bug Report

Docsify doesn't resolve relative links in embedded markdown files correctly. Whenever MD file contains any relative link instead of file content user just gets Not found 404 error.

Steps to reproduce

README.md

[Task](./task/README.md ':include')

task/README.md

# Crossword:

On the last page you found a weird crossword puzzle. Perhaps it reveals a flag for you.

[crosswords.png](./crosswords.png ':ignore')

task/crosswords.png

What is current behaviour

Link to crosswords.png points to /crosswords.png

What is the expected behaviour

Link to crosswords.png should point to /task/crosswords.png

Other relevant information

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

  • Your OS: Ubuntu 16.04

  • Node.js version: v10.15.3

  • npm/yarn version: 6.4.1

  • Browser version: 74.0.3729.169

  • Docsify version: 4.9.4

  • Docsify plugins: N/A

@filipgoc
Copy link

filipgoc commented Jul 4, 2019

I second the problem. This makes embeds useless unless everything is plain text with no media.

Is this a bug or a limitation?

Is there a way to handle this with aliases in the index file? (I tried, but unsuccessfully.)

@filipgoc
Copy link

filipgoc commented Jul 4, 2019

This is a duplicate of the very old #695, but this issue contains more info and a formatted example.

@filipgoc
Copy link

filipgoc commented Jul 5, 2019

This really messes up my workflow. If anyone has any ideas for a workaround (not even thinking of a fix, just a hack), please. Any suggestions welcome!

filipgoc added a commit to IMADE3D/awesome-docs that referenced this issue Jul 5, 2019
- I'll be splitting this creating a duplicate because I simply can't
achieve the structure I'm looking for because of this bug
docsifyjs/docsify#865
@filipgoc
Copy link

filipgoc commented Jul 5, 2019

Ok I have a workaround. Phew. It's NOT a fix, but it makes it workable; with a bit of manual work.

Add relative symlinks to all the relevant directories and files.

In the most simple case, let's say I have assets folder where all the images are stored.

I can add a symlink to this folder with the same name, and the relative links resolve correctly (through the symlink).

I have tested it and it works.

Feel free to ping me if you're trying the same thing and have issues.

Tip: I also discovered I needed to add an empty
<span></span> at the end of every markdown file that has an :include, otherwise my footer does not work properly (my footer is created as a plugin in the index.html...)

As in

Some paragraph. 

[filename](include.md ':include')

<span></span>

@aenniw aenniw mentioned this issue Jul 6, 2019
19 tasks
@stale
Copy link

stale bot commented Feb 4, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Feb 4, 2020
@dellagustin-sap
Copy link

Hello, we have this issue as well in our website based on docsify, please keep it open until #867 is either merged or closed.

@stale stale bot removed the wontfix label Feb 4, 2020
@anikethsaha anikethsaha added the bug confirmed as a bug label Feb 4, 2020
@dellagustin-sap
Copy link

I believe this issue is still happening, we are currently using docsify 4.11.3, I need to create a dedicated example.

@anikethsaha
Copy link
Member

create a separate issue if it still exists with sandbox example.

Thanks

@dellagustin-sap
Copy link

That's the plan 😉

@dellagustin-sap
Copy link

I actually found out that in order to have the behaviour I wanted, I had to set option relativePath to true.

https://docsify.js.org/#/configuration?id=relativepath

There is a side effect though, the sidebar links become relative to the current path.
This can be solved (or worked around) by making the sidebar links absolute.

I could not find whether this is by design or if it is a bug, should I report it as an issue?
I have a repository demonstrating it: https://dellagustin-sap.github.io/docsify-relative-path-bug-report/#/

@dellagustin-sap
Copy link

I found out that the behavior I reported in the previous comment related to relative paths and the sidebar was already reported here: #925

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug confirmed as a bug path-resolving
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants