Skip to content

Commit 5106676

Browse files
committed
add more introduction on usage
1 parent 1881513 commit 5106676

File tree

1 file changed

+42
-22
lines changed

1 file changed

+42
-22
lines changed

README.md

Lines changed: 42 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,12 @@ Convert image links in all Markdown files within a folder to online Markdown lin
1111
### 目录
1212

1313
- [简介](#简介)
14-
- [安装](#安装)
15-
- [使用](#使用)
16-
- [使用命令行参数](#使用命令行参数)
17-
- [使用配置文件](#使用配置文件)
18-
- [结合使用](#结合使用)
19-
- [配置](#配置)
20-
- [运行测试](#运行测试)
14+
- [使用安装包运行程序](#使用安装包运行程序)
15+
- [使用Python运行或开发](#使用Python运行或开发)
16+
- [安装](#安装)
17+
- [使用](#使用)
18+
- [配置](#配置)
19+
- [运行测试](#运行测试)
2120

2221
### 简介
2322

@@ -32,7 +31,9 @@ Convert image links in all Markdown files within a folder to online Markdown lin
3231

3332
想把有道云笔记里的几千篇笔记迁移到 Obsidian 中,感谢[youdaonote-pull](https://github.com/DeppWang/youdaonote-pull)提供的有道云笔记的全量导出功能,很快把所有笔记导出到了本地文件夹,但是由于几千张笔记中的图片也保留在本地,不方便移动端使用,所以想把图片上传到图床,使用markdown链接到笔记里。于是自己写了个批量转换并上传图片的程序。
3433

35-
## 安装包运行
34+
## 使用安装包运行程序
35+
36+
下载windows或macOS的安装包,解压后配置`config.json`文件,运行程序即可。
3637

3738
1. 下载安装包
3839
2. 解压
@@ -47,6 +48,8 @@ Convert image links in all Markdown files within a folder to online Markdown lin
4748

4849

4950
## 使用Python运行或开发
51+
52+
如果安装包不满足需求,可以使用Python运行或开发。
5053
### 安装
5154

5255
环境准备:python、poetry
@@ -110,16 +113,15 @@ poetry run pytest
110113
---
111114

112115
## English Documentation
116+
113117
### Table of Contents
114-
- [English Documentation](#english-documentation)
115-
- [Table of Contents](#table-of-contents)
116-
- [Introduction](#introduction)
117-
- [Motivation](#motivation)
118+
119+
- [Introduction](#introduction)
120+
- [Motivation](#motivation)
121+
- [Installation by Executable Package](#installation-by-executable-package)
122+
- [Using Python for Running or Development](#using-python-for-running-or-development)
118123
- [Installation](#installation)
119124
- [Usage](#usage)
120-
- [Using Command-Line Arguments](#using-command-line-arguments)
121-
- [Using a Configuration File](#using-a-configuration-file)
122-
- [Combining Both](#combining-both)
123125
- [Configuration](#configuration)
124126
- [Running Tests](#running-tests)
125127

@@ -136,7 +138,25 @@ Main features:
136138

137139
I wanted to migrate thousands of notes from Youdao Cloud Notes to Obsidian. Thanks to [youdaonote-pull](https://github.com/DeppWang/youdaonote-pull) for providing a full export feature for Youdao Cloud Notes, I quickly exported all notes to a local folder. However, since the images in the thousands of notes were also kept locally, it was inconvenient for mobile use. Therefore, I wanted to upload the images to an image hosting service and use markdown links in the notes. So, I wrote a program to batch convert and upload images.
138140

139-
### Installation
141+
## Installation by Executable Package
142+
143+
Download the installation package for Windows or macOS, unzip it, and configure the `config.json` file. Then run the program.
144+
1. Download the installation package
145+
2. Extract it
146+
3. Configure the `config.json` file
147+
- Set `vault_directory` to the path of your notes folder
148+
- Set `upload_url` to the URL of your PicList/PicGo service
149+
- Set `base_url` to the URL of your image hosting service
150+
- Set `cleanup` to determine whether to clean up local images
151+
4. Run the program
152+
- Windows users can double-click `upload-images.exe` to run it.
153+
- macOS users can run `./upload-images` in the terminal.
154+
155+
### Using Python for Running or Development
156+
157+
If the executable package does not meet your needs, you can use Python to run or develop.
158+
159+
#### Installation
140160

141161
Prerequisites: Python, Poetry
142162

@@ -146,33 +166,33 @@ Run the following command to install dependencies and set up the environment:
146166
poetry install
147167
```
148168

149-
### Usage
169+
#### Usage
150170

151171
You can run the script with command-line arguments or specify a configuration file.
152172

153-
#### Using Command-Line Arguments
173+
##### Using Command-Line Arguments
154174

155175
```bash
156176
python upload_all_images_in_markdown/main.py <vault_directory> --upload_url <UPLOAD_URL> --cleanup
157177
```
158178

159-
#### Using a Configuration File
179+
##### Using a Configuration File
160180

161181
```bash
162182
python upload_all_images_in_markdown/main.py --config config.json
163183
```
164184

165185
If no configuration file is specified, the default `config.json` will be used.
166186

167-
#### Combining Both
187+
##### Combining Both
168188

169189
Command-line arguments will override the values in the configuration file.
170190

171191
```bash
172192
python upload_all_images_in_markdown/main.py --config config.json --upload_url <UPLOAD_URL>
173193
```
174194

175-
### Configuration
195+
#### Configuration
176196

177197
Before running the tests, edit a `config.json` file in the project root directory to include your specific configuration values. You can use the provided `config.sample.json` as a template:
178198

@@ -190,7 +210,7 @@ Before running the tests, edit a `config.json` file in the project root director
190210

191211
Ensure that all paths and URLs are correctly set according to your environment and requirements. This configuration file is crucial for the script to function correctly, as it dictates where to find the Markdown files, where to upload the images, and how to handle the images post-upload.
192212

193-
### Running Tests
213+
#### Running Tests
194214

195215
To run the unit tests, use the following command:
196216

0 commit comments

Comments
 (0)