-
-
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
feat: prepend root to image path #111
Conversation
@hexojs/core |
I'm not testing it, but I think you can get it with |
yeah, where do I put it? How does renderer.js access |
hexo loads the hexo plug-in in node_modules (from the file registered in main), but forcibly passes the hexo object. Since other files cannot be automatically acquired when loaded, the plug-in itself must acquire the hexo object on its own. |
I can load url_for with const url_for = require('hexo/lib/plugins/helper/url_for')
// or
const url_for = require('../../../node_modules/hexo/lib/plugins/helper/url_for') But url_for can't access the config.root
Edit: Fixed |
This PR could also be added to |
Doesn't work with We can make a note |
https://hexo.io/api/helper#How-do-I-use-another-registered-helper-inside-my-custom-helper Try this? const url_for = hexo.extend.helper.get('url_for').bind(hexo); |
Thanks. The latest commit resolve it. Currently I'm stuck at const url_forCfg = Object.assign({}, {
config: {
root: this.config.root,
relative_link: this.config.relative_link
},
path: data.path,
relative_url: this.extend.helper.get('relative_url')
}); But Edit: I added a check so that Edit: I just realized |
Pending hexojs/hexo-util#82 Edit: Now utilize hexo-util url_for(). |
encodeURL is added in hexo-util 1.1.0.
url_for is added in hexo-util 1.2.0.
This feature can be enabled through
prependRoot
option, which is disabled by default.