49 lines
1.1 KiB
Markdown
49 lines
1.1 KiB
Markdown
## 功能列表
|
|
|
|
- 删除当前`Markdown`文件中未引用的图片
|
|
- 发现未引用图片后,会打印出来,询问是否需要删除
|
|
|
|
原理:获取指定目录下所有的图片名字,然后在文件中检索是否存在。若不存在则认为是未引用图片。
|
|
|
|
==注意==只要文章中存在图片的命令(带后缀),即使没有正确按照`Markdown`语法引用,也认为是引用的。使用的时候注意一下
|
|
|
|
## 快速开始
|
|
|
|
1. 安装依赖
|
|
|
|
```bash
|
|
pip install -r requirements.txt
|
|
```
|
|
|
|
2. 运行程序
|
|
|
|
```bash
|
|
python remove.py test.md
|
|
```
|
|
|
|
3. 运行结果
|
|
|
|
```bash
|
|
.\test.md encoding is utf-8, confidence: 0.99
|
|
img:img.png
|
|
find 1 unuse img files:
|
|
test.assets\img.png
|
|
would you want to delete them?(y or n):y
|
|
delete test.assets\img.png
|
|
```
|
|
|
|
## 用法说明
|
|
|
|
```bash
|
|
usage: remove.py [-h] [-a ASSETS] file
|
|
|
|
positional arguments:
|
|
file specifi the markdown file
|
|
|
|
options:
|
|
-h, --help show this help message and exit
|
|
-a ASSETS, --assets ASSETS
|
|
specifi the img dir
|
|
```
|
|
|