You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
@source is an internal shim, cuz we are generating temp files from source files. Ideally we should remove the shim, allowing relative image reference from markdown directly.
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 ifa
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 packagea
.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
The text was updated successfully, but these errors were encountered: