-
-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
md img render part improvement of hexo-render-marked #216
Comments
This issue has been automatically marked as stale because lack of recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Unstale |
Same request here With the |
@ChanryLimmy code doesn't seem to work for me, I modified it a little, and the following code works fine for me. Others can refer to it. "hexo-renderer-marked@^5.0.0", if (!/^(#|\/\/|http(s)?:)/.test(href) && !relative_link && prependRoot) {
if (!href.startsWith('/') && !href.startsWith('\\') && postPath) {
const PostAsset = hexo.model('PostAsset');
// findById requires forward slash
// ***************** Add the following code *******************
const fixPostPath = join(postPath, '../');
const asset = PostAsset.findById(join(fixPostPath, href.replace(/\\/g, '/')));
// const asset = PostAsset.findById(join(postPath, href.replace(/\\/g, '/')));
// ************************** End *****************************
// asset.path is backward slash in Windows
if (asset) href = asset.path.replace(/\\/g, '/');
}
href = url_for.call(hexo, href);
} |
I have written a plugin to solve this, hexo-relative-link |
I made a pr #271 and hopefully this solves the issue. More tests are welcome! |
Background
u know when we use other md editor write a post, the img with relative path is like this
![makabaka](postname/1.jpg)
, but here in hexo-render-marked i must use![makabaka](1.jpg)
if the config like this:it means there must be one side between md editor & hexo can't see the pic.
My solution
i opened
node_modules -> hexo-render-marked -> lib -> render.js
and change the image part (between the *** lines):it works. so the following is my suggests about this product experience
Feature Request
tks a lot!
The text was updated successfully, but these errors were encountered: