docsify icon indicating copy to clipboard operation
docsify copied to clipboard

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

Open poerlang opened this issue 2 years ago • 2 comments

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 avatar Feb 03 '24 02:02 poerlang

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);
  });

poerlang avatar Feb 03 '24 03:02 poerlang

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.

Koooooo-7 avatar Feb 09 '24 14:02 Koooooo-7

Bug acknowledged. Tracking with #1891.

jhildenbiddle avatar Mar 02 '24 04:03 jhildenbiddle