Skip to content

Latest commit

 

History

19 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hexo-include-image 0.0.1

Version 0.0.1

用于下载hexo项目sourse/_posts目录下所有文章内的图片,并且使用Tag Plugin语法替换图片。

前提: 将根目录的_config.yml中的post_asset_folder设置为true,因为Hexo 3以及Hexo 3以上的版本内置了tag plugin,所以Hexo 3以下的版本还需要安装Tag Plugin依赖。了解更多Asset Folders

Usage

$ git clone https://github.com/todoi/hexo-include-image.git
$ cd hexo-include-image && npm i
$ npx ts-node src/cli.ts -P [你的博客保存目录]

Example:

npx ts-node src/cli.ts -P ../blog/source/_posts

Description

  1. 如果检测到文章内有需要下载到本地的图片,会在_posts目录下面创建与文章同名的目录
  2. 图片下载之后会自动保存到_posts文章同名目录下
  3. 替换结果 原本文章图片![xxx](https://zhgzhg.me/images/avatar.jpg) 替换成功之后{% asset_img avatar.jpg "xxx'src-https://zhgzhg.me/images/avatar.jpg'"%}

Warning

  • 这个脚本只能作用于markdown语法![]()引入的图片,对于html标签<img>引入的图片不起作用
  • 操作之前请做好commit或者备份,以免数据丢失

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages