Skip to content

[Feature request] Recognize @source and maybe treat all @ started path as alias with markdown image #1584

@Mister-Hope

Description

@Mister-Hope

Clear and concise description of the problem

Some people may want to reference image from root, but in our latest changes, the markdown image syntax no longer supports alias.

![](a/b.jpg) is regarded as <img src="./a/b.jpg" /> even if a is a package name or valid alias.

This is more expected as a/b.jpg will be a relative path in most cases instead a path that need to be resolved with bundler.

Also, we provided backwards ability, that in case people want to use alias or package imports, they can use img tag:

<img src="a/b.jpg" /> will be ./b.jpg exports in package a.

But we internally support @source for src folder, and when users want to reference images in projects folder instead of public (in most cases people are using i18n, and a image is placed at root language, and they want to make the link constant in all languages like @source/guide/example.png)

Suggested solution

We'd better check whether a markdown image link is started with @source/ , to avoid a @source/a.jpg being parsed as @source/folder/@source/a.jpg from @source/folder/file.md.

And we may even treat all links started with @ as alias. This is more flexible that allows markdown image be default as relative links but still supports alias.

Alternative

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions