hexo-add-img-attr
v1.0.1
Published
为文章中的img标签添加refererPolicy的属性,以解决url图片加载失败问题
Downloads
2
Maintainers
Readme
功能说明
为文章中的img标签添加refererPolicy=no-referrer的属性,以解决url图片加载失败问题
使用方法
在hexo的package.json文件中,添加 "hexo-add-img-attr": "^1.0.1"
例如:
{
"name": "hexo-site",
"version": "0.0.0",
"private": true,
"scripts": {
"build": "hexo generate",
"clean": "hexo clean",
"deploy": "hexo deploy",
"server": "hexo server"
},
"hexo": {
"version": "7.3.0"
},
"dependencies": {
"hexo": "^7.3.0",
"hexo-generator-archive": "^2.0.0",
"hexo-generator-category": "^2.0.0",
"hexo-generator-index": "^4.0.0",
"hexo-generator-json-content": "^4.2.3",
"hexo-generator-search": "^2.4.3",
"hexo-generator-sitemap": "^3.0.1",
"hexo-generator-tag": "^2.0.0",
"hexo-renderer-ejs": "^2.0.0",
"hexo-renderer-marked": "^6.3.0",
"hexo-renderer-sass": "^0.5.0",
"hexo-renderer-stylus": "^3.0.1",
"hexo-server": "^3.0.0",
"hexo-theme-landscape": "^1.0.0",
"hexo-add-img-attr": "^1.0.0"
}
}
版本号
version": "1.0.1"
版本更新
1.0.1: 解决对代码块中的换行会新增的问题
实现方式:当文章的html代码生成后,hook得到html内容,然后找到img标签,添加属性
hexo.extend.filter.register('after_post_render',(data)=>{
});