Coder Social home page Coder Social logo

hexo-asset-image's Introduction

hexo-asset-image

Give asset image in hexo a absolutely path automatically

Usege

npm install hexo-asset-image --save

Example

MacGesture2-Publish
├── apppicker.jpg
├── logo.jpg
└── rules.jpg
MacGesture2-Publish.md

Make sure post_asset_folder: true in your _config.yml.

Just use ![logo](logo.jpg) to insert logo.jpg.

History

2018-04-18: support hexo-abbrlink

hexo-asset-image's People

Contributors

driftcrow avatar fangchieh avatar frapples avatar goshin avatar wanguanglu avatar wisfern avatar xcodebuild avatar yafey avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

hexo-asset-image's Issues

permalink=*.html 会出现异常

hexo: 3.3.1
hexo-cli: 1.0.2
os: Windows_NT 6.1.7601 win32 x64
http_parser: 2.7.0
node: 6.9.2
v8: 5.1.281.88
uv: 1.9.1
zlib: 1.2.8
ares: 1.10.1-DEV
icu: 57.1
modules: 48
openssl: 1.0.2j```
当我将hexo 的_config.yml中的permalink修改为 :title.html时,会出现以下异常
```FATAL Something's wrong. Maybe you can find the solution here: http://hexo.io/do
cs/troubleshooting.html
Error: ENOENT: no such file or directory, open 'c:\hexo\blog\public\zabbix-timeo
ut.html\001.png```
    at Error (native)`
当将permalink修改为 :title/时,一切正常

图片加载问题

hexo-asset-image插件已经安装,博客设置如下
bg7ywl-10-11_11-3-0
尝试填文件夹图片也不显示
bg7ywl-10-11_11-3-30
Debug图
bg7ywl-10-11_11-4-29

公共图片引用

不知道有没有办法引用公共图片,图片放在source/img下

在使用最新版 NexT 时,hexo -g 编译出错,“replace”未定义

报错如下:

TypeError: Cannot read property 'replace' of undefined
at Object. (E:\HEXOBLOG\node_modules\hexo-asset-image\index.js:31:38)
at initialize.exports.each (E:\HEXOBLOG\node_modules\hexo-asset-image\node_modules\cheerio\lib\api\traversing.js:293:24)
at Hexo. (E:\HEXOBLOG\node_modules\hexo-asset-image\index.js:29:16)

请问这是什么原因?
我使用旧版的 NexT(4.0.0) 就可以编译通过。

codeblock `<>` render wrong

如果在代码区域中出现 <> 之类的标签,使用这个插件后会使得 <> 无法显示。

如果是

`<a>`

正常情况下会被解释为

<code><a></code>

而使用这个插件以后会被解释为

<code><a></a></code>

如此 <a> 就无法被显示出来。

不知道是什么原因产生的 bug。

有个问题

我是用hexo + github 搭建的博客。用这个在文章中添加图片。

  • 在本地查看博客时:可以正常的显示图片;但是发布到github后,用博客地址就不能查看了。
  • 出现的结果就是:The requested content cannot be loaded.Please try again later

Path parsing should be improved

Now. The follow image path can be parsed correctly:

![test](test/test.png)

But, I think it will be better to support this form of path (windows style):

![test](test\test.png)

Thanks very much.

建议能兼容markdowm语法

建议能兼容markdowm语法,能在文件markdowm内就能看到图片,而不是编译后通过网页访问才能看到图片

图片路径问题,无法显示

我的图片的路径看起来好奇怪。这是我的package.json文件,部署之后路径有问题无法显示图片。我是win10,但是我看了一下我同学的就可以用,他的路径是/img/***.png。
3
4
1
2

TypeError: Cannot read property 'replace' of undefined

下载完成后,进行hexo g时出现错误。
错误代码如下:不知是何原因
$ hexo g
FATAL Something's wrong. Maybe you can find the solution here: http://hexo.io/do cs/troubleshooting.html
TypeError: Cannot read property 'replace' of undefined
at Object. (D:\Hexo\blog\node_modules\hexo-asset-image\index.js:3 1:38)
at exports.each (D:\Hexo\blog\node_modules\cheerio\lib\api\traversing.js:293 :24)
at Hexo. (D:\Hexo\blog\node_modules\hexo-asset-image\index.js:29: 16)
at Hexo.tryCatcher (D:\Hexo\blog\node_modules\hexo\node_modules\bluebird\js\ main\util.js:26:23)
at Hexo. (D:\Hexo\blog\node_modules\hexo\node_modules\bluebird\js \main\method.js:15:34)
at D:\Hexo\blog\node_modules\hexo\lib\extend\filter.js:68:35
at tryCatcher (D:\Hexo\blog\node_modules\hexo\node_modules\bluebird\js\main\ util.js:26:23)
at ReductionPromiseArray._promiseFulfilled (D:\Hexo\blog\node_modules\hexo\n ode_modules\bluebird\js\main\reduce.js:105:38)
at Promise._settlePromiseAt (D:\Hexo\blog\node_modules\hexo\node_modules\blu ebird\js\main\promise.js:589:26)
at Promise._settlePromises (D:\Hexo\blog\node_modules\hexo\node_modules\blue bird\js\main\promise.js:700:14)
at Async._drainQueue (D:\Hexo\blog\node_modules\hexo\node_modules\bluebird\j s\main\async.js:123:16)
at Async._drainQueues (D:\Hexo\blog\node_modules\hexo\node_modules\bluebird\ js\main\async.js:133:10)
at Immediate.Async.drainQueues (D:\Hexo\blog\node_modules\hexo\node_modules\ bluebird\js\main\async.js:15:14)
at runCallback (timers.js:570:20)
at tryOnImmediate (timers.js:550:5)
at processImmediate [as _immediateCallback] (timers.js:529:5)
FATAL Cannot read property 'replace' of undefined
TypeError: Cannot read property 'replace' of undefined
at Object. (D:\Hexo\blog\node_modules\hexo-asset-image\index.js:3 1:38)
at exports.each (D:\Hexo\blog\node_modules\cheerio\lib\api\traversing.js:293 :24)
at Hexo. (D:\Hexo\blog\node_modules\hexo-asset-image\index.js:29: 16)
at Hexo.tryCatcher (D:\Hexo\blog\node_modules\hexo\node_modules\bluebird\js\ main\util.js:26:23)
at Hexo. (D:\Hexo\blog\node_modules\hexo\node_modules\bluebird\js \main\method.js:15:34)
at D:\Hexo\blog\node_modules\hexo\lib\extend\filter.js:68:35
at tryCatcher (D:\Hexo\blog\node_modules\hexo\node_modules\bluebird\js\main\ util.js:26:23)
at ReductionPromiseArray._promiseFulfilled (D:\Hexo\blog\node_modules\hexo\n ode_modules\bluebird\js\main\reduce.js:105:38)
at Promise._settlePromiseAt (D:\Hexo\blog\node_modules\hexo\node_modules\blu ebird\js\main\promise.js:589:26)
at Promise._settlePromises (D:\Hexo\blog\node_modules\hexo\node_modules\blue bird\js\main\promise.js:700:14)
at Async._drainQueue (D:\Hexo\blog\node_modules\hexo\node_modules\bluebird\j s\main\async.js:123:16)
at Async._drainQueues (D:\Hexo\blog\node_modules\hexo\node_modules\bluebird\ js\main\async.js:133:10)
at Immediate.Async.drainQueues (D:\Hexo\blog\node_modules\hexo\node_modules\ bluebird\js\main\async.js:15:14)
at runCallback (timers.js:570:20)
at tryOnImmediate (timers.js:550:5)
at processImmediate [as _immediateCallback] (timers.js:529:5)

1.0.0版本的代码对link的处理存在问题

1.0.0版本17-26行代码如下:

    if(/.*\/index\.html$/.test(link)) {
      // when permalink is end with index.html, for example 2019/02/20/xxtitle/index.html
      // image in xxtitle/ will go to xxtitle/index/
      appendLink = 'index/';
      var endPos = link.lastIndexOf('/');
    }
    else {
      var endPos = link.lastIndexOf('.');
    }
    link = link.substring(beginPos, endPos) + '/' + appendLink;

fail to install in linux.

my input and output information:

npm install hexo-asset-image --save
[email protected] /home/ziyuan/Program/Hexo
└── [email protected]

npm WARN optional Skipping failed optional dependency /hexo/hexo-fs/chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: [email protected]
npm WARN optional Skipping failed optional dependency /hexo/nunjucks/chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: [email protected]
npm WARN optional Skipping failed optional dependency /hexo-deployer-git/hexo-fs/chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: [email protected]
npm WARN optional Skipping failed optional dependency /hexo-math/hexo-fs/chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: [email protected]

项目在子目录下,生成链接有重复

hexo配置如下

url: http://192.168.16.166/cn
root: /cn/

实际生成图片地址如下
http://192.168.16.166/cn/cn/ssa.png
预期生成图片地址如下:
http://192.168.16.166/cn/ssa.png

ps:已安装hexo-abbrlink

issue in the Windows about inserting picture with markdown syntax,while not in Macos(using other image plugin)

Environmet

  • NexT theme version 7.4.0 from GitHub release;
  • hexo-asset-link installed with npm install --s
  • post_asset_folder option turned on in _config.yml
  • windows10 1909

show the exact package.json

{
  "name": "hexo-site",
  "version": "0.0.0",
  "private": true,
  "hexo": {
    "version": "4.0.0"
  },
  "dependencies": {
    "babel-runtime": "^6.26.0",
    "hexo": "^4.0.0",
    "hexo-abbrlink": "^2.0.5",
    "hexo-all-minifier": "^0.5.3",
    "hexo-asset-image": "^1.0.0",
    "hexo-deployer-git": "^2.1.0",
    "hexo-footnotes": "^1.0.2",
    "hexo-generator-archive": "^1.0.0",
    "hexo-generator-category": "^1.0.0",
    "hexo-generator-feed": "^2.1.1",
    "hexo-generator-index": "^1.0.0",
    "hexo-generator-search": "^2.4.0",
    "hexo-generator-tag": "^1.0.0",
    "hexo-renderer-ejs": "^1.0.0",
    "hexo-renderer-marked": "^2.0.0",
    "hexo-renderer-stylus": "^1.1.0",
    "hexo-server": "^1.0.0",
    "hexo-symbols-count-time": "^0.7.0"
  }
}

Test Case

Show the <!doctype html> in the chrome

(i don't know how to paste the word,cause i am beginner)

image

How to Reproduce

(in windows 10 1909)

  1. Establish one blank posts with commands hexo new "英语学习的经验分享"
  2. Paste the picture in the file of "英语学习的经验分享" in the _post file,and qoute it with mardown syntex,like the picture below
    image
  3. Run hexo s and visit http://locahost:4000 to check out the issue,like the picture below

image

the expction

like the picture(test in the macos with the hexo-asset-link plugin)

image

install failed

$ npm install https://github.com/CodeFalling/hexo-asset-image --save
npm ERR! fetch failed https://github.com/CodeFalling/hexo-asset-image
npm WARN retry will retry, error on last attempt: Error: fetch failed with status code 406
npm ERR! fetch failed https://github.com/CodeFalling/hexo-asset-image
npm WARN retry will retry, error on last attempt: Error: fetch failed with status code 406
npm ERR! fetch failed https://github.com/CodeFalling/hexo-asset-image
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "D:\Program Files\nodejs\node.exe" "D:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "https://github.com/CodeFalling/hexo-asset-image" "--save"
npm ERR! node v0.12.0
npm ERR! npm v2.5.1

npm ERR! fetch failed with status code 406
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! http://github.com/npm/npm/issues

npm ERR! Please include the following file with any support request:
npm ERR! F:\github\wuxiaolan91.github.io\npm-debug.log

Failed to Show Image

file _config.yml
post_asset_folder: true
file sample.md
![image1](sample/image1.jpg)
image sample/image1.jpg

but generate file index.html
<img src="/2016/01/31/sample/sample/image1.jpg" alt="image1">

how to make it show image on my site?

静态文件生成的图片路径不正确

about路径下有一个文件叫index.md 我在这个路径下创建了一个index文件夹,png图片放在index路径下

about/
-------index,md
-------index

在index.md文件中插入图片:

!【支付宝扫一扫,请博主喝杯咖啡】(index/ap1g9yh63op41h7z62.png)

生成的src路径是/about/indexhtmlap1g9yh63op41h7z62.png

注:上面为了显示方便,所以符号用的中文符号,我在实际index.md中用的是英文符号。

建议,用 data.title 代替

本人没有用 title 作为 permant link 的组成部分,导致这个插件没法用。建议改用 data.title 匹配内容,代码还简洁一些。

permalink: :year/:month/:day/:title 如果加上“.html”会有问题

刚刚测试,如果在 “_config..yml” 里,把 permalink: :year/:month/:day/:title加上“.html”,该插件就无法正常使用,生成时路径会把 “.html” 也一起生成,最后生成路径会为“D:\hexo\template\public\2017\03\14\jqexamplee.html\logo.jpg”。除了把“.html”去掉,不知道有没有其他方法可以修改?

文件更新后,页面刷新显示 未命名

在本地使用过程中发现,在 使用了 hexo-asset-image 之后, 如果更新了文件, 预览的时候 文件就无法正常显示, 一定要 重新 hexo g , 然后 hexo s -p 80 才能预览。

文件在 Typora 编辑器的 非 Source Code Mode 才会出现这个情况。

绝对路径生成不完整

我使用该插件仍旧无法正常显示图片,查看html发现图片路径生成不完整,只有日,没有年月。
如下
img src="/22/imagetest/500.jpg" alt="500"

md文件完整语句如下:

title: imagetest
date: 2017-01-22 20:24:21
tags:

500

请问如何解决?谢谢

path error

<img src="/2016/05/14/my.htmllogo.jpg" title="logo">

code
![logo](MacGesture2-Publish/logo.jpg)

lack /

success
/2016/05/14/my.html/logo.jpg

中文编码问题

您好,我在使用时发现该插件会将中文修改为unicode编码,而在index.js中cheerio.load方法下添加参数:decodeEntities: false,可以避免这个问题
var $ = cheerio.load(data[key], {
ignoreWhitespace: false,
xmlMode: false,
lowerCaseTags: false,
decodeEntities: false
});

参考:https://cnodejs.org/topic/54bdd639514ea9146862ac37, 不知道可不可以修改一下此处。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.