Skip to content

Same file + extension in directory names breaks relative image assets #8921

Closed

Description

@kaspar-p

Have you read the Contributing Guidelines on issues?

Prerequisites

Description

When referencing static images that are colocated with alongside the Markdown file, if the directory name has <filename>.md in it, the image can't be found.

For example, a file like file.md, with a nearby directory called file.md__static_image_assets__, will break. It attempts to find the file in the global /static folder, even if the path in file.md is like:

[some image](./file.md__static_image_assets/image.png)

This is a legal directory name, so this should work.

Reproducible demo

https://stackblitz.com/edit/github-znyym6?file=docs/file.md

Steps to reproduce

  1. See the reproduction:
  2. Have a folder in docs/ called file.md__static_image__assets with an image.png image in it.
  3. Have a file.md in docs/ with content of something like
![my image](./file.md__static_image_assets__/image.png)
  1. Verify it won't compile.

Expected behavior

Should compile.

Actual behavior

Doesn't compile, looks for the image in /static.

Your environment

Public source code: https://stackblitz.com/edit/github-znyym6?file=docs/file.md

Self-service

  • I'd be willing to fix this bug myself.

Activity

  1. added
    bug
    status: needs triage
    on Apr 24, 2023
  2. Josh-Cena commented on Apr 25, 2023

    @Josh-Cena
    Collaborator

    There is a fault with our link replacement logic. I will refactor this part of the code since it's getting really dense. Thanks for reporting!

  3. added
    domain: markdown
    and removed
    status: needs triage
    on Apr 25, 2023
  4. self-assigned this
    on Apr 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugdomain: markdown

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions