fix: add more asset-searching locations and solve a known issue #271
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This resolves #216.
Until now, if I would like to insert an image named
image.jpg
in a post with the filenamefoo.md
with these configurations:and the filesystem structure:
I have to use
![](image.jpg)
instead of![](foo/image.jpg)
otherwise hexo would not generate a valid img src. However, if I would like to preview the markdown file while editing, I have to use the latter one. This is contradictory.So I made a modification to allow
hexo-renderer-marked
to search for assets not only in current asset foldersource/_posts/foo
, but also in its parent foldersource/_posts
, so that![](foo/image.jpg)
can also be located and the src can be generated correctly.Moreover, this change is compatible with the previous versions and developers can safely update the package to a new version without the need for changing each and every link in their blogs.
Notice: the changes have passed the tests on Linux (WSL2, Ubuntu 22.04).
I hope these changes are acceptable.