Skip to content

Conversation

Mister-Hope
Copy link
Member

This is an issue in all VuePress versions.

![中国](./中国.png)

should be allowed. But markdown-it 's default behavior will encode it to ./%E4%B8%AD%E5%9B%BD.png, so that bundler won't be able to find the image file.

I made a fix in V1 by my vuepress-plugin-md-enhance, but I think V2 can support it.

@Mister-Hope Mister-Hope changed the title fix(markdown): fix relative asserts path fix(markdown): fix relative assets path May 20, 2021
@Mister-Hope Mister-Hope requested a review from meteorlxy May 20, 2021 12:22
@meteorlxy
Copy link
Member

meteorlxy commented May 20, 2021

I just added more test cases, which will fail for now.

I think we should make all those cases passed.

(You can still modify those test cases as needed)

@Mister-Hope
Copy link
Member Author

Mister-Hope commented May 20, 2021

I don't think alias is needed, as I am not thinking of any situation which a person should define a alia containing chinese. While a markdown folder likely to contain chinese images,(like harmony os official docs), so relative links is necessary.

Even if we resolve those alias begin with @, alias are not forced to begin with @.

The only way to fit this is to decode back every link not begin with / , comparing with decoding every relative links now.

@meteorlxy
Copy link
Member

meteorlxy commented May 20, 2021

I think just decode the original src is enough. No need to add too many codes

Copy link
Member

@meteorlxy meteorlxy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made some refactor. Thanks for your contribution ❤️

@meteorlxy meteorlxy changed the title fix(markdown): fix relative assets path fix(markdown): decode assets link to ensure bundler can find the file May 23, 2021
@meteorlxy meteorlxy merged commit d3e5409 into vuepress:main May 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants