MIT License

项目介绍

PicGo/picgo-plugin-pic-migrater 是一个托管在 GitHub 上的开源项目,主要使用 TypeScript 编写,采用 MIT License 许可证,目前获得 160 个 Star、17 次 Fork。

仓库全名
PicGo/picgo-plugin-pic-migrater
开源许可证
MIT License
Star 数
160
Fork 数
17
未关闭 Issue
4

README 摘要

picgo-plugin-pic-migrater A PicGo plugin for pictures in markdown files migrating from one picBed to another one. 中文说明 Features 1. This plugin can be used in CLI & GUI version of PicGo! 2. It supports absolute and relative path of images, and the url path of images. 3. It supports both markdown format and html format image url in markdown file. (Since v1.3.0) For example, a test.md: if you choose imgur as your…

完整内容见 GitHub 原始 README 或本页 。

常见问题

picgo-plugin-pic-migrater 用什么语言开发?

主要使用 TypeScript 编写,采用 MIT License 许可证,目前有 160 个 Star。

picgo-plugin-pic-migrater 可以免费商用吗?

仓库采用 MIT License 许可证,可免费使用与修改,商业使用请遵守许可证条款(例如保留版权声明与许可声明)。

如何获取 picgo-plugin-pic-migrater 的源码?

可以直接克隆仓库:git clone https://github.com/PicGo/picgo-plugin-pic-migrater.git,默认分支为 dev;安装与运行步骤见仓库 README。

picgo-plugin-pic-migrater 最近还在维护吗?

仓库最近一次更新为 2月4日,当前有 4 个未关闭 Issue;Star 数为 160,可作为社区活跃度的参考。

关于

:truck:A PicGo plugin for pictures in markdown files migrating from one image host to another one.

描述取自 GitHub 官方 API,中文内容由 GitRead 中文社区 编辑团队整理。

简要分析

热度分
196
价值分
101
活跃状态
活跃

语言占比

JavaScript
Python
TypeScript

Release

README

picgo-plugin-pic-migrater

PicGo Convention

A PicGo plugin for pictures in markdown files migrating from one picBed to another one.

中文说明

Features

  1. This plugin can be used in CLI & GUI version of PicGo!
  2. It supports absolute and relative path of images, and the url path of images.
  3. It supports both markdown format and html format image url in markdown file. (Since v1.3.0)

For example, a test.md:

![](./js.jpg)
![](http://xxx.com/js.jpg)

<!-- since v1.3.0, support migrating img src -->
<img src="http://yyy.com/js.jpg" />

if you choose imgur as your migrated picBed, after migrating:

![](https://i.imgur.com/xxx.jpg)
![](https://i.imgur.com/xxxx.jpg)

<!-- since v1.3.0, support migrating img src -->
<img src="http://i.imgur.com/xxxxx.jpg" />

Version required

picgo-plugin-pic-migrater <= 1.2.2 requires PicGo-GUI version 2.0.2 ~ 2.2.0, PicGo-Cli version 1.4.0 ~ 1.5.0-.

picgo-plugin-pic-migrater > 1.2.2 requires PicGo-GUI version 2.3.0 ~ latest beta, PicGo-Cli version 1.5.0-alpha.1 ~ latest alpha.

Installation

CLI

picgo install pic-migrater

Then pic-migrater will registe a command named migrate.

GUI

search for pic-migrater

Configuration

Please configurate this plugin first!

After migrating, a new markdown file will be written in the same folder. So you should configurate this new file name’s suffix first.

CLI

picgo set plugin pic-migrater

GUI

Open the setting page in the menu of the plugin.

Details

newFileSuffix

For example, if your origin file named 2019.md & if you set the newFileSuffix to _new, then after migrating, a new file named 2019_new.md will be created.

include

If you set the include configuration then migrator will only migrate the files’ path or url which match the include.

For example, if your set the include to sinaimg.cn, then migrator will only migrate the url or path includes sinaimg.cn.

exclude

If you set the exclude configuration then migrator will only migrate the files’ path or url which don’t match the exclude.

For example, if your set the exclude to sinaimg.cn, then migrator will only migrate the url or path doesn’t includes sinaimg.cn.

oldContentWriteToNewFile

Since v1.3.0

If you set the oldContentWriteToNewFile to true, then the old content will be written to the new file and the migrated content will be written to the old file.

Usage

CLI

$ picgo migrate -h
Usage: migrate [options] <files...>

migrating pictures url from markdown files

Options:
  -h, --help  output usage information

Note:
You should configurate this plugin first!
picgo set plugin pic-migrater

Examples:

  # migrate file or files
  $ picgo migrate ./test.md ./test1.md

  # migrate markdown files in folder
  $ picgo migrate ./test/

GUI

Node.js Project(v1.2.3+)

const { PicGo } = require('picgo')
const PluginMigrater = require('picgo-plugin-pic-migrater')

const picgo = new PicGo()

picgo.setConfig({
  'picgo-plugin-pic-migrater': {
    newFileSuffix: '_new',
    include: '',
    exclude: ''
  }
})

const plugin = PluginMigrater(picgo)

plugin.migrateFiles(['/xxx/yyy.md']) // { total: number, success: number }

Thanks

Thanks to @Moyf with the python version of this plugin.

评论

暂无评论