Skip to content

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

Description

@poerlang

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

Activity

  1. poerlang commented on Feb 3, 2024

    @poerlang
    Author

    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);
      });
  2. Koooooo-7 commented on Feb 9, 2024

    @Koooooo-7
    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.

  3. jhildenbiddle commented on Mar 2, 2024

    @jhildenbiddle
    Member

    Bug acknowledged. Tracking with #1891.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions