wens07 / hexo-image-link

当MD中引用本地文件时,处理生成的html中的图片链接。

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

hexo-image-link

When enabled hexo post_asset_folder: true, convert the markdown image path to asset_img syntax, to make the image display both in typora and hexo.

![image file label](markdown-file-name/local-image.png) -> {% asset_img label local-image.png %}

在Hexo启用post_asset_folder: true选项后,将Markdown语法的图片路径转换为asset_img的方式,使图片能够在使用typora编辑和hexo预览发布时都能正常显示。

在原有hexo-image-link基础上做简单修改, 适合自己的post写作

hexo-asset-image's problem

网上很多资料提示使用 hexo-asset-image 插件,但是在 hexo 4.2.0 环境下,生成的路径不对,如下:

update link as:-->/.cn//Screenshot-150-1-20200314081849804.png
update link as:-->/.cn//image-20200314080935503.png

Usage 用法

$ npm install hexo-image-link --save
or
$ npm install git@github.com:wens07/hexo-image-link.git --save

Enable hexo-asset-folder: true.

$ hexo new 20200315-es-monitoring-guide
INFO  Created: ~/Projects/hexo-blog/blog/source/_posts/20200315-es-monitoring-guide.md
$ ls -lh source/_posts/
total 56
drwxr-xr-x@  9 wens07  staff   288B  3 15 10:28 ./
drwx------+ 32 wens07  staff   1.0K  3 14 07:52 ../
drwxr-xr-x@  2 wens07  staff    64B  3 15 10:28 20200315-es-monitoring-guide/
-rw-r--r--@  1 wens07  staff    76B  3 15 10:28 20200315-es-monitoring-guide.md

Edit Markdown and insert image.

![label](20200315-es-monitoring-guide/image-name.jpg)

Then generate public files.

$ hexo generate

Release Note

  • 2022-12-13 Fix problem that unsupport path with space

参考资料

  1. hexo image link
  2. hexo-asset-image
  3. hexo-simple-image

About

当MD中引用本地文件时,处理生成的html中的图片链接。


Languages

Language:JavaScript 100.0%