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

image url begin with "/" should be AbsolutePath,not RelativePath #2369

Closed
poerlang opened this issue Feb 3, 2024 · 3 comments
Closed

image url begin with "/" should be AbsolutePath,not RelativePath #2369

poerlang opened this issue Feb 3, 2024 · 3 comments

Comments

@poerlang
Copy link

poerlang commented Feb 3, 2024

Bug Report

Steps to reproduce

add a md file in a sub1 dir /docs/sub1/test.md

add a img.png in /docs/images

add a imgLink in sub1/test.md:
![](/images/img.png)

Current behaviour

docsify render the image url to :

/./sub1/images/img.png

Expected behaviour

docsify should render the image url to :

/images/img.png

  • Docsify version:
  • [x ] Bug still occurs when all/other plugins are disabled?

Please create a reproducible sandbox

reproducible sandbox

@poerlang
Copy link
Author

poerlang commented Feb 3, 2024

the regular expression in isAbsolutePath function only considers the cases ofhttp://or https://, but does not take into account URLs that start with /, so the bug happen

var isAbsolutePath = cached(function (path) {
    return /(:|(\/{2}))/g.test(path);
  });

@Koooooo-7
Copy link
Member

Hi @poerlang , thx for your report!
We already raised this issue in #1891, we still discuss on how to refactor its behavior and keep the things work more as expectation.

@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

3 participants