From 59482c359e99b4358ff84b83d38c52049c715093 Mon Sep 17 00:00:00 2001 From: fengbohan <1953356163@qq.com> Date: Fri, 12 Jan 2024 14:02:50 +0800 Subject: [PATCH] add readme --- ReadMe.md | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ requirements.txt | 1 + 2 files changed, 49 insertions(+) create mode 100644 ReadMe.md create mode 100644 requirements.txt diff --git a/ReadMe.md b/ReadMe.md new file mode 100644 index 0000000..0065d71 --- /dev/null +++ b/ReadMe.md @@ -0,0 +1,48 @@ +## 功能列表 + +- 删除当前`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 +``` + diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..3f69d02 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +chardet==5.2.0