Skip to content

[Bug] DocFX link validator doesn't accept ~ as a file link root #11030

Description

@N7K4

Describe the bug

I use ~ to set my image root, so I avoid "navigation" via ".." (folder up). Image-Tag or Include-Tag around the markdown files in different levels. So I like "~" to avoid folder-level issues.

I get a warning

About.md: warning InvalidFileLink: Invalid file link:(~/assets/img/views/en/light/About.png).

The images are "copied" in the build step from my "test-project" to assets/img/views, my docfx.json (partly)

{
  "resource": [
     ...
      {
        "files": "**/*.png",
        "src": "../App.Specs/screenshots/",
        "dest": "assets/img/views",
        "exclude": []
      },
     ...
  ]
}

My Preferred way - can be used from everywhere

![Image of AboutView](~/assets/img/views/en/light/About.png "Image of AboutView (light mode)")

The "Classic way" with ".." navigation

![Image of AboutView](../../../assets/img/views/en/light/About.png "Image of AboutView (light mode)")

To Reproduce
Steps to reproduce the behavior:

  1. Create a folder outside the docfx tree and add some images inside
  2. Copy the png-files in build step of docfx to "_site" target
  3. Create a markdown that reference the image with a ~-path
  4. Build the html _site via dotnet docfx build
  5. BUG: AboutView.md: warning InvalidFileLink: Invalid file link:(~/assets/img/views/en/light/About.png).

Expected behavior
The ~ should be a valid link, No InvalidFileLink warning in build

Context (please complete the following information):

  • OS: Windows
  • Docfx version: [e.g. 2.78.3]

Additional context
nothing

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions