From 3f2a7e2734e5ceb6e200b0bcf8ea1c2fea1bfa5f Mon Sep 17 00:00:00 2001 From: Core Date: Sun, 7 Apr 2019 18:47:53 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E6=AD=A3?= =?UTF-8?q?=E5=88=99=E5=8C=B9=E9=85=8D=E8=A1=A8=E8=BE=BE=E5=BC=8F=EF=BC=8C?= =?UTF-8?q?=E8=A7=A3=E5=86=B3=E4=BA=86=E6=A0=87=E9=A2=98=E4=BB=A5=E2=80=98?= =?UTF-8?q?http=E2=80=99=E5=BC=80=E5=A4=B4=E8=80=8C=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E5=9B=BE=E7=89=87src=E6=9B=B4=E6=9B=BF?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/index.js b/index.js index 59da07d..00ef6fc 100644 --- a/index.js +++ b/index.js @@ -30,8 +30,7 @@ hexo.extend.filter.register('after_post_render', function(data){ if ($(this).attr('src')){ // For windows style path, we replace '\' to '/'. var src = $(this).attr('src').replace('\\', '/'); - if(!/http[s]*.*|\/\/.*/.test(src) && - !/^\s*\//.test(src)) { + if(!/^(((http|https|ftp|rtsp|mms)+:\/{2})|\/).+/.test(src)) { // For "about" page, the first part of "src" can't be removed. // In addition, to support multi-level local directory. var linkArray = link.split('/').filter(function(elem){ From 843dc1b241a906a350d119d8b8081f80457cb83f Mon Sep 17 00:00:00 2001 From: Core Date: Wed, 17 Apr 2019 17:54:09 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=B9=B6=E7=BF=BB?= =?UTF-8?q?=E8=AF=91=E4=BA=86readme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 52eaf03..b57c2bd 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,21 @@ -# hexo-asset-image +# hexo-asset-image-fixed +本仓库修复了原包在`文章标题出现[http]/[https]等关键词时会无法转换src`的问题 + +This repository fix a bug that `Cannot transfer the property 'scr' when the title contains a keyword like[http]/[https]` + +由于提交[PR](https://github.com/dangxuandev/hexo-asset-image/pull/42)后原作者一直没有更新,暂时将此仓库作为新的npm包发布。 + +Because of my [PR](https://github.com/dangxuandev/hexo-asset-image/pull/42) being ignored by the author, who seems will not maintain this repository anymore, I published this repository as the new npm package temporarily. + +自动将hexo中的图片资源替换为绝对路径 Give asset image in hexo a absolutely path automatically # Usege ```shell -npm install hexo-asset-image --save +npm install hexo-asset-image-fixed --save ``` # Example @@ -19,6 +28,10 @@ MacGesture2-Publish MacGesture2-Publish.md ``` +确保网站配置`_config.yml`中选项设置为:`post_asset_folder: true`。 + Make sure `post_asset_folder: true` in your `_config.yml`. +就可以直接使用`![logo](logo.jpg)`来插入图片`logo.jpg`啦。 + Just use `![logo](logo.jpg)` to insert `logo.jpg`. From 70894b7ac9c0d91266038c1b7baedd9a7bbc20ab Mon Sep 17 00:00:00 2001 From: Core Date: Wed, 17 Apr 2019 18:19:25 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BA=86package.json?= =?UTF-8?q?=E5=B9=B6=E5=9C=A8npm=E4=B8=8A=E5=8F=91=E5=B8=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 8ff6229..bd91b9d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { - "name": "hexo-asset-image", - "version": "0.0.3", - "description": "Give asset image in hexo a absolutely path automatically", + "name": "hexo-asset-image-fixed", + "version": "0.0.5", + "description": "Give asset image in hexo a absolutely path automatically. See details on https://github.com/Core00077/hexo-asset-image", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" @@ -12,7 +12,7 @@ "asset", "path" ], - "author": "codefalling", + "author": "core00077", "license": "MIT", "dependencies": { "cheerio": "^0.19.0" From c3493ccf1970b1fe844b6453bf6f0fea8b60e70d Mon Sep 17 00:00:00 2001 From: Core Date: Sat, 18 Jan 2020 17:28:19 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E5=BC=95=E7=94=A8=E4=BA=86=E6=9C=80?= =?UTF-8?q?=E6=96=B0=E7=9A=84cheerio?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index bd91b9d..19462ea 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hexo-asset-image-fixed", - "version": "0.0.5", + "version": "0.0.6", "description": "Give asset image in hexo a absolutely path automatically. See details on https://github.com/Core00077/hexo-asset-image", "main": "index.js", "scripts": { @@ -15,6 +15,6 @@ "author": "core00077", "license": "MIT", "dependencies": { - "cheerio": "^0.19.0" + "cheerio": "^1.0.0-rc.3" } }