diff --git a/README.md b/README.md index 6ad3cc6..2006417 100644 --- a/README.md +++ b/README.md @@ -1,129 +1,53 @@ # MarkPic -MarkPic 是一个 Windows 桌面工具:把 Markdown 文档里的本地图片上传到 PicGo 图床,并把文档里的图片地址替换成图床链接。它也可以反向处理文章里已有的网络图片:只做检测,或者下载到本地。 +[English](README.md) | [简体中文](README.zh-CN.md) -程序是单个 exe,界面内嵌,不需要 Node 或本地服务。数据放在 exe 旁边的 `data` 目录。 +MarkPic is a desktop app for the images inside Markdown documents. It does three +independent jobs: -## 功能 +- **Upload** — find the local images a document references, send them to your + [PicGo](https://github.com/Molunerfinn/PicGo) image host, and rewrite the links to + the hosted URLs. +- **Check** — walk the remote images an article already points at and report the ones + that are dead, are not images, or come back truncated. Read-only. +- **Download** — pull those remote images into a local `images/` folder and rewrite + the links to relative paths. -- **上传本地图片**:扫描 Markdown / HTML 里的本地图片,经 PicGo 上传,替换成图床地址。 -- **检测远程图片**:逐个检查文章里的网络图片,报告打不开、不是图片、只返回半截等状况;只读,不改文档。 -- **下载远程图片**:把网络图片下载到文档旁边的 `images/`(目录可改),链接改成相对路径。 -- **队列**:拖入文件或文件夹,支持并发、取消、失败重试、只看问题;每张图的明细可以展开。 -- **去重与缓存**:同一张图只上传一次;已经上传/下载过且内容未变的图直接复用。 -- **三种输出**:sidecar、就地改写(带备份)、输出到指定目录。 -- **桌面集成**:亮色/暗色/跟随系统、中文/英文、关闭到托盘、单实例。 +It ships as one self-contained app with the UI embedded: no Node.js, no local server, +no command line. Uploads go through PicGo's local HTTP interface, so MarkPic never +sees your image-host credentials. -## 使用 +## At a glance -1. 安装并启动 [PicGo](https://github.com/Molunerfinn/PicGo),配置好图床。 -2. 在 PicGo 的 **设置 → 设置 Server** 里启用服务(默认 `http://127.0.0.1:36677`)。 -3. 打开 MarkPic,把 `.md` 文件或文件夹拖进窗口。 -4. 在左侧选择 **上传**、**检测** 或 **下载**,然后开始。 - -上传只走本机的 PicGo HTTP 接口,MarkPic 不接触图床密钥。检测和下载不上传图片,不需要 PicGo 开着。 - -### 三种作业 - -| 作业 | 处理什么 | 会改文档吗 | 需要 PicGo | +| Job | What it touches | Rewrites the document | Needs PicGo running | | --- | --- | --- | --- | -| 上传 | 本地图片 → 图床 | 会 | 是 | -| 检测 | 检查远程图片是否可用 | 不会 | 否 | -| 下载 | 远程图片 → 本地 `images/` | 会 | 否 | - -上传时,文章里原有的远程图片原样保留。检测只读远程地址,但也会指出“文档引用了、磁盘上却不存在”的本地图。下载只处理远程图,本地图保留。 - -### 输出方式 - -| 模式 | 结果 | -| --- | --- | -| sidecar(默认) | 生成 `note.converted.md`,原文件不动 | -| in-place | 改写原文件,先备份成 `note.md.bak` | -| directory | 写到指定目录;同名文件自动加序号,不覆盖已有文件 | - -## 支持的写法 - -```markdown -![图片](images/a.png) -![图片](images/a.png "标题") -![图片]() -![](images/有(括号).png) - - - -![完整][ref1] ![折叠][] ![简写] -[ref1]: images/a.png -``` - -- 支持引用式图片、HTML `src` / `srcset` / ``、一行多图、带空格或括号的路径。 -- 跳过远程图、`data:`、缺失的本地文件,以及 `.ps` / `.eps` / `.pdf` / `.ai` / `.psd` / `.sketch` / `.fig` / `.drawio` 这类附件。 -- 代码块、行内代码、HTML 注释、`
` / `` 里的图片不处理。
-- 读写 UTF-8(含 BOM)、带 BOM 的 UTF-16 和本机 ANSI 代码页;输出保持原编码。
-
-## 设置
-
-设置面板里可以改:
-
-- PicGo 地址、并发数、重试次数。
-- 是否复用上次的上传/下载结果。
-- 输出方式、输出目录、sidecar 后缀、远程图存放目录。
-- 主题(亮色 / 暗色 / 跟随系统)、语言(中文 / 英文)。
-- 关闭窗口时询问、最小化到托盘,还是直接退出;是否开机/启动时进入托盘。
-
-## 数据目录
-
-默认在 exe 旁边:
-
-```text
-MarkPic.exe
-data/
-  settings.json
-  upload-cache.json
-  remote-cache.json
-  webview2/
-```
-
-如果 exe 所在目录不可写,会退回 `%APPDATA%\markpic`。也可以用环境变量 `MARKPIC_DATA_DIR` 指定别的目录。
-
-## 开发
+| Upload | local images → image host | yes | yes |
+| Check | remote image URLs | no | no |
+| Download | remote images → `images/` | yes | no |
 
-需要 Go 1.24+。构建或修改前端需要 Node 20.19+ 和 pnpm;构建脚本会自动执行 `pnpm --dir web install`。
+Documents keep their original encoding — UTF-8 (with or without BOM), UTF-16 with a
+BOM, and the machine's ANSI code page. Apart from the rewritten image addresses,
+everything comes back byte-for-byte identical.
 
-```bash
-npm run build        # 构建前端 + bin/MarkPic.exe
-npm run build:go     # 只编 Go(需要已有 internal/ui/dist)
-npm run start        # Vite 5173 + 窗口热更新
-npm run start:mock   # 带假图床,不连 PicGo
-npm run test
-npm run typecheck
-```
+## Install
 
-`internal/ui/dist` 不提交到版本库,它是 `go:embed` 的输入。`build`、`start`、`test` 发现产物缺失时会自动构建前端。直接 `go run ./cmd/markpic` 也可以,但同样需要先有 `internal/ui/dist`。
+Download `MarkPic-v-windows-amd64.exe` from
+[Releases](https://github.com/geekMus/MarkPic/releases). There is no installer: put
+it anywhere and run it. An installed copy updates itself; settings and caches live in
+the `data/` folder next to the executable.
 
-### 目录结构
+Windows is the only platform published so far; macOS and Linux are planned, but not
+verified yet.
 
-| 路径 | 内容 |
-| --- | --- |
-| `cmd/markpic` | 入口、单实例、原生窗口、bridge、标题栏 |
-| `internal/app` | bridge 方法表与事件 |
-| `internal/mdscan` | Markdown 扫描与按字节替换 |
-| `internal/imgpath` | 图片地址分类与解析 |
-| `internal/picgo` | PicGo 上传客户端 |
-| `internal/conv` | 转换流水线 |
-| `internal/remoteimg` | 远程图片检测与下载 |
-| `internal/remotecache` | 下载缓存 |
-| `internal/uploadcache` | 上传缓存 |
-| `internal/settings` | 设置读写 |
-| `internal/platform` | 原生对话框 |
-| `internal/update` | 更新检查与安装 |
-| `internal/ui` | 前端产物(`go:embed`) |
-| `web` | Vue 3 + TypeScript + Vite 前端 |
-| `scripts` | 构建、启动、测试脚本 |
-| `tools/bench` | 基准测试 |
-| `tools/mockpicgo` | 假图床 |
+## Quick start
 
-图标资源在 `assets/`;常规构建直接使用已提交的 `.ico` 和 `.syso`,不需要重新生成。
+1. Install and start [PicGo](https://github.com/Molunerfinn/PicGo), then enable its
+   server under **Settings → Server** (default `http://127.0.0.1:36677`).
+2. Drop `.md` files or a folder onto the MarkPic window.
+3. Choose **Upload**, **Check** or **Download** on the left and start.
 
-## 文档
+## Documentation
 
-- [Bridge API](docs/API.md)
+- [Usage](docs/usage.md) — supported syntax, output modes, settings, data directory
+- [Build & development](docs/build.md) — toolchain, scripts, repository layout
+- [Bridge API](docs/API.md) — internal WebView2 bridge between the UI and Go
diff --git a/README.zh-CN.md b/README.zh-CN.md
new file mode 100644
index 0000000..4b5ff30
--- /dev/null
+++ b/README.zh-CN.md
@@ -0,0 +1,45 @@
+# MarkPic
+
+[English](README.md) | [简体中文](README.zh-CN.md)
+
+MarkPic 是一个桌面工具,处理 Markdown 文档里的图片。三件事互相独立:
+
+- **上传**:找出文档引用的本地图片,交给 [PicGo](https://github.com/Molunerfinn/PicGo)
+  图床上传,再把文档里的地址换成图床链接。
+- **检测**:逐个检查文章里已有的网络图片,报告打不开、不是图片、只返回半截的状况。只读,不改文档。
+- **下载**:把这些网络图片下载到本地的 `images/`,链接改成相对路径。
+
+程序是单个自包含的应用,界面内嵌:不需要 Node.js,不起本地服务,没有命令行。上传只走 PicGo
+的本机 HTTP 接口,MarkPic 不接触你的图床密钥。
+
+## 一眼看懂
+
+| 作业 | 处理什么 | 会改文档吗 | 需要 PicGo 开着 |
+| --- | --- | --- | --- |
+| 上传 | 本地图片 → 图床 | 会 | 是 |
+| 检测 | 网络图片地址 | 不会 | 否 |
+| 下载 | 网络图片 → `images/` | 会 | 否 |
+
+文档保持原编码:UTF-8(含或不含 BOM)、带 BOM 的 UTF-16、以及本机 ANSI 代码页。
+除了被替换掉的图片地址,其余内容一个字节都不变。
+
+## 安装
+
+从 [Releases](https://github.com/geekMus/MarkPic/releases) 下载
+`MarkPic-v<版本>-windows-amd64.exe`。没有安装程序:放哪都能跑。已安装的版本会自己更新,
+设置与缓存放在 exe 旁边的 `data/` 目录里。
+
+目前只发布 Windows 版;macOS 和 Linux 在计划中,但还没有在真机上验证过。
+
+## 快速开始
+
+1. 安装并启动 [PicGo](https://github.com/Molunerfinn/PicGo),在 **设置 → 设置 Server**
+   里启用服务(默认 `http://127.0.0.1:36677`)。
+2. 把 `.md` 文件或文件夹拖进 MarkPic 窗口。
+3. 在左侧选 **上传**、**检测** 或 **下载**,然后开始。
+
+## 文档
+
+- [使用说明](docs/usage.zh-CN.md):支持的写法、输出方式、设置、数据目录
+- [构建与开发](docs/build.zh-CN.md):工具链、脚本、目录结构
+- [Bridge API](docs/API.zh-CN.md):内嵌界面与 Go 之间的通信接口
diff --git a/docs/API.md b/docs/API.md
index 45e7cd6..1a53a86 100644
--- a/docs/API.md
+++ b/docs/API.md
@@ -1,8 +1,12 @@
 # Bridge API
 
-界面和 Go 进程通过 WebView2 自带的 bridge 通信。这个程序没有 HTTP 服务、命令行或对外接口;下面这套方法只服务于内嵌界面。方法表在 `internal/app/dispatch.go`。
+[English](API.md) | [简体中文](API.zh-CN.md) · back to [README](../README.md)
 
-## 调用
+The UI and the Go process talk over the bridge that ships with WebView2. There is no
+HTTP service, no command line and no public interface — this method table only serves
+the embedded UI. It lives in `internal/app/dispatch.go`.
+
+## Calling
 
 ```ts
 const reply = await window.markpic(
@@ -11,63 +15,69 @@ const reply = await window.markpic(
 )
 ```
 
-`params` 必须是 JSON 字符串:WebView2 会把每个参数单独反序列化。前端统一在参数里带 `lang`(`zh` / `en`),Go 侧据此返回对应语言的文案。
+`params` must be a JSON string: WebView2 deserializes each argument on its own. The
+frontend always sends `lang` (`zh` / `en`) inside the params, and the Go side uses it to
+pick the wording.
 
-## 响应
+## Replies
 
 ```json
 { "ok": true, "data": { } }
 { "ok": false, "code": "conflict", "message": "已经有一轮在跑了" }
 ```
 
-失败不会 reject Promise;界面按 `code` 分支、把 `message` 展示给用户。
+Failures never reject the promise; the UI branches on `code` and shows `message`.
 
-| code | 含义 |
+| code | meaning |
 | --- | --- |
-| `bad_request` | 参数不合法 |
-| `conflict` | 同一页已有一轮在跑,或状态冲突 |
-| `unsupported` | 当前平台不支持(例如原生对话框) |
-| `not_found` | 未知方法 |
-| `internal` | 服务端内部错误 |
+| `bad_request` | invalid params |
+| `conflict` | a run is already going on this page, or the state conflicts |
+| `unsupported` | not available on this platform (native dialogs, for example) |
+| `not_found` | unknown method |
+| `internal` | internal server error |
 
-## 方法
+## Methods
 
-| 方法 | 参数 | 返回 |
+| method | params | returns |
 | --- | --- | --- |
-| `app.hello` | `{lang}` | 版本、数据目录、语言 |
+| `app.hello` | `{lang}` | version, data directory, language |
 | `i18n.set` | `{lang}` | `{lang}` |
-| `health` | — | PicGo 连通性等状态 |
-| `settings.get` | — | 当前设置 |
-| `settings.put` | 设置字段 | 保存后的设置 |
-| `settings.closeAction` | `{action}` | `{closeAction}`;只改关闭行为,不碰未保存的设置草稿 |
+| `health` | — | PicGo reachability and similar status |
+| `settings.get` | — | current settings |
+| `settings.put` | settings fields | the saved settings |
+| `settings.closeAction` | `{action}` | `{closeAction}`; only the close behaviour, leaving an unsaved draft alone |
 | `dialog.files` | — | `{paths}` |
 | `dialog.folder` | — | `{paths}` |
-| `preview` | `{paths, settings?}` | 扫描预览 |
-| `scan.start` | `{scanId, paths, settings?}` | 已受理;结果通过 `scan.file` 推送 |
-| `scan.cancel` | `{scanId, path?}` | `{cancelled}`;带 `path` 只取消那一份 |
-| `run.start` | `{paths, settings?}` | 启动一轮转换;`mode` 由设置里的远程模式决定 |
-| `run.current` | `{mode?}` | 该页当前那一轮的快照,用于界面重载后接回 |
+| `preview` | `{paths, settings?}` | scan preview |
+| `scan.start` | `{scanId, paths, settings?}` | accepted; results arrive as `scan.file` events |
+| `scan.cancel` | `{scanId, path?}` | `{cancelled}`; with `path` only that file is cancelled |
+| `run.start` | `{paths, settings?}` | starts a conversion run; `mode` comes from the remote mode in settings |
+| `run.current` | `{mode?}` | the run this page already has, to reattach after a reload |
 | `run.cancel` | `{runId}` | `{ok}` |
-| `reveal` | `{path}` | `{ok}`;在资源管理器中定位 |
-| `open` | `{target}` | `{ok}`;打开文件或目录 |
-| `update.status` | — | 当前更新状态(不联网) |
-| `update.check` | — | 检查更新;失败原因写在 `status.error` |
-| `update.install` | — | 下载、校验、替换并重启 |
+| `reveal` | `{path}` | `{ok}`; reveal in the file manager |
+| `open` | `{target}` | `{ok}`; open a file or folder |
+| `update.status` | — | current update state (offline) |
+| `update.check` | — | check for updates; the reason for a failure lands in `status.error` |
+| `update.install` | — | download, verify, replace and restart |
 
-## 事件
+## Events
 
-Go 侧通过 `window.__markpicEvents(payload)` 推送。`payload` 可以是单个事件,也可以是事件数组;终止事件(`run.finished`、`run.cancelled`、`scan.done`)不批量延迟。
+Go pushes through `window.__markpicEvents(payload)`. `payload` is either a single event
+or an array of events; terminal events (`run.finished`, `run.cancelled`, `scan.done`) are
+never batched or delayed.
 
-| type | 关键字段 |
+| type | key fields |
 | --- | --- |
-| `run.started` | `runId`、`mode`、`files` |
-| `file.started` | `runId`、`id` |
-| `file.progress` | `runId`、`id`、`uploaded`、`done`、`total`、`items` |
-| `file.finished` | `runId`、`id`、`result` |
+| `run.started` | `runId`, `mode`, `files` |
+| `file.started` | `runId`, `id` |
+| `file.progress` | `runId`, `id`, `uploaded`, `done`, `total`, `items` |
+| `file.finished` | `runId`, `id`, `result` |
 | `run.cancelled` | `runId` |
-| `run.finished` | `runId`、`summary` |
-| `log` | `level`、`message` |
-| `scan.file` | `runId`(扫描时放 `scanId`)、`path`、`scanned`、`cancelled`、`timedOut` |
-| `scan.done` | `runId`(扫描时放 `scanId`) |
+| `run.finished` | `runId`, `summary` |
+| `log` | `level`, `message` |
+| `scan.file` | `runId` (`scanId` when scanning), `path`, `scanned`, `cancelled`, `timedOut` |
+| `scan.done` | `runId` (`scanId` when scanning) |
 
-`run.started` 里的 `mode` 区分上传 / 检测 / 下载三页,界面按它认领自己的那一轮。页面刷新后先调 `run.current` 拿回当前快照,再继续接收事件。
+`mode` in `run.started` tells the three pages apart (upload / check / download); each
+page claims the run that belongs to it. After a page refresh, call `run.current` first
+to get the current snapshot, then keep receiving events.
diff --git a/docs/API.zh-CN.md b/docs/API.zh-CN.md
new file mode 100644
index 0000000..5d547c9
--- /dev/null
+++ b/docs/API.zh-CN.md
@@ -0,0 +1,75 @@
+# Bridge API
+
+[English](API.md) | [简体中文](API.zh-CN.md) · 返回 [README](../README.zh-CN.md)
+
+界面和 Go 进程通过 WebView2 自带的 bridge 通信。这个程序没有 HTTP 服务、命令行或对外接口;下面这套方法只服务于内嵌界面。方法表在 `internal/app/dispatch.go`。
+
+## 调用
+
+```ts
+const reply = await window.markpic(
+  'run.start',
+  JSON.stringify({ paths: ['D:/notes/a.md'], lang: 'zh' }),
+)
+```
+
+`params` 必须是 JSON 字符串:WebView2 会把每个参数单独反序列化。前端统一在参数里带 `lang`(`zh` / `en`),Go 侧据此返回对应语言的文案。
+
+## 响应
+
+```json
+{ "ok": true, "data": { } }
+{ "ok": false, "code": "conflict", "message": "已经有一轮在跑了" }
+```
+
+失败不会 reject Promise;界面按 `code` 分支、把 `message` 展示给用户。
+
+| code | 含义 |
+| --- | --- |
+| `bad_request` | 参数不合法 |
+| `conflict` | 同一页已有一轮在跑,或状态冲突 |
+| `unsupported` | 当前平台不支持(例如原生对话框) |
+| `not_found` | 未知方法 |
+| `internal` | 服务端内部错误 |
+
+## 方法
+
+| 方法 | 参数 | 返回 |
+| --- | --- | --- |
+| `app.hello` | `{lang}` | 版本、数据目录、语言 |
+| `i18n.set` | `{lang}` | `{lang}` |
+| `health` | — | PicGo 连通性等状态 |
+| `settings.get` | — | 当前设置 |
+| `settings.put` | 设置字段 | 保存后的设置 |
+| `settings.closeAction` | `{action}` | `{closeAction}`;只改关闭行为,不碰未保存的设置草稿 |
+| `dialog.files` | — | `{paths}` |
+| `dialog.folder` | — | `{paths}` |
+| `preview` | `{paths, settings?}` | 扫描预览 |
+| `scan.start` | `{scanId, paths, settings?}` | 已受理;结果通过 `scan.file` 推送 |
+| `scan.cancel` | `{scanId, path?}` | `{cancelled}`;带 `path` 只取消那一份 |
+| `run.start` | `{paths, settings?}` | 启动一轮转换;`mode` 由设置里的远程模式决定 |
+| `run.current` | `{mode?}` | 该页当前那一轮的快照,用于界面重载后接回 |
+| `run.cancel` | `{runId}` | `{ok}` |
+| `reveal` | `{path}` | `{ok}`;在资源管理器中定位 |
+| `open` | `{target}` | `{ok}`;打开文件或目录 |
+| `update.status` | — | 当前更新状态(不联网) |
+| `update.check` | — | 检查更新;失败原因写在 `status.error` |
+| `update.install` | — | 下载、校验、替换并重启 |
+
+## 事件
+
+Go 侧通过 `window.__markpicEvents(payload)` 推送。`payload` 可以是单个事件,也可以是事件数组;终止事件(`run.finished`、`run.cancelled`、`scan.done`)不批量延迟。
+
+| type | 关键字段 |
+| --- | --- |
+| `run.started` | `runId`、`mode`、`files` |
+| `file.started` | `runId`、`id` |
+| `file.progress` | `runId`、`id`、`uploaded`、`done`、`total`、`items` |
+| `file.finished` | `runId`、`id`、`result` |
+| `run.cancelled` | `runId` |
+| `run.finished` | `runId`、`summary` |
+| `log` | `level`、`message` |
+| `scan.file` | `runId`(扫描时放 `scanId`)、`path`、`scanned`、`cancelled`、`timedOut` |
+| `scan.done` | `runId`(扫描时放 `scanId`) |
+
+`run.started` 里的 `mode` 区分上传 / 检测 / 下载三页,界面按它认领自己的那一轮。页面刷新后先调 `run.current` 拿回当前快照,再继续接收事件。
diff --git a/docs/build.md b/docs/build.md
new file mode 100644
index 0000000..401866c
--- /dev/null
+++ b/docs/build.md
@@ -0,0 +1,72 @@
+# Build & development
+
+[English](build.md) | [简体中文](build.zh-CN.md) · back to [README](../README.md)
+
+## Requirements
+
+Go 1.24+ to build the binary. Changing the UI also needs Node 20.19+ and pnpm —
+the build scripts run `pnpm --dir web install` for you.
+
+## Commands
+
+Run from the repository root:
+
+| Command | What it does |
+| --- | --- |
+| `npm run build` | build the frontend, then `bin/MarkPic.exe` |
+| `npm run build:go` | compile Go only (needs an existing `internal/ui/dist`) |
+| `npm run start` | Vite on 5173 plus a window with hot reload |
+| `npm run start:mock` | same, against a fake image host instead of PicGo |
+| `npm run test` | `go test ./... -count=1` |
+| `npm run typecheck` | `vue-tsc --noEmit` only |
+
+`internal/ui/dist` is not committed: it is the `go:embed` input. `build`, `start` and
+`test` rebuild the frontend automatically when the output is missing. Plain
+`go run ./cmd/markpic` works too, but also needs `internal/ui/dist` to exist first.
+
+## Repository layout
+
+| Path | Contents |
+| --- | --- |
+| `cmd/markpic` | entry point, single instance, native window, bridge, title bar |
+| `internal/app` | bridge method table and events |
+| `internal/mdscan` | Markdown scanning and byte-range replacement |
+| `internal/imgpath` | classifying and resolving image addresses |
+| `internal/picgo` | PicGo upload client |
+| `internal/conv` | conversion pipeline |
+| `internal/remoteimg` | remote image checking and downloading |
+| `internal/remotecache` | download cache |
+| `internal/uploadcache` | upload cache |
+| `internal/settings` | reading and writing settings |
+| `internal/platform` | native dialogs, ANSI code page |
+| `internal/update` | update check and install |
+| `internal/ui` | embedded frontend output (`go:embed`) |
+| `web` | Vue 3 + TypeScript + Vite frontend |
+| `scripts` | build, start and test scripts |
+| `tools/bench` | benchmarks |
+| `tools/mockpicgo` | fake image host |
+
+Icons live in `assets/`. Normal builds reuse the committed `.ico` and `.syso` files, so
+they are not regenerated.
+
+## Branches and releases
+
+- Development happens on `dev`. `main` only receives merges from `dev`, and a
+  protected-branch rule enforces it.
+- A merge to `main` triggers **构建并发布**. It runs only when the diff touches
+  `cmd/`, `internal/`, `web/`, `scripts/`, `assets/`, `tools/`, `go.mod`, `go.sum` or
+  `package.json` — documentation-only merges do not ship a release.
+- The version is the release date (CalVer, `Asia/Shanghai`); a second release on the
+  same day becomes `2026.11.17.1` and so on, discovered from tags.
+- A commit subject containing `[no-release]` builds and tests, but publishes nothing.
+- The release carries the executable plus `version.json`, the manifest that clients
+  read to find updates. Nothing is pushed back to the repository.
+- Release notes are generated by `scripts/release-notes.mjs` from the commits since the
+  previous tag. Preview them locally with:
+
+```bash
+npm run notes -- --version 2026.11.17 --dry-run
+```
+
+A `同步 main 到 dev` workflow merges `main` back into `dev` after every merge, and
+`主从同步检查` blocks a pull request whose branch does not contain the latest `main`.
diff --git a/docs/build.zh-CN.md b/docs/build.zh-CN.md
new file mode 100644
index 0000000..f7edfe2
--- /dev/null
+++ b/docs/build.zh-CN.md
@@ -0,0 +1,67 @@
+# 构建与开发
+
+[English](build.md) | [简体中文](build.zh-CN.md) · 返回 [README](../README.zh-CN.md)
+
+## 环境
+
+编二进制需要 Go 1.24+。改界面还要 Node 20.19+ 和 pnpm——构建脚本会自动跑
+`pnpm --dir web install`。
+
+## 常用命令
+
+在仓库根目录执行:
+
+| 命令 | 作用 |
+| --- | --- |
+| `npm run build` | 构建前端,再编出 `bin/MarkPic.exe` |
+| `npm run build:go` | 只编 Go(要求已有 `internal/ui/dist`) |
+| `npm run start` | 起 Vite 5173 + 带热更新的窗口 |
+| `npm run start:mock` | 同上,但连假图床,不碰 PicGo |
+| `npm run test` | `go test ./... -count=1` |
+| `npm run typecheck` | 只跑 `vue-tsc --noEmit` |
+
+`internal/ui/dist` 不进版本库,它是 `go:embed` 的输入。`build`、`start`、`test` 发现产物
+缺失时会自动构建前端。直接 `go run ./cmd/markpic` 也可以,但同样要先有 `internal/ui/dist`。
+
+## 目录结构
+
+| 路径 | 内容 |
+| --- | --- |
+| `cmd/markpic` | 入口、单实例、原生窗口、bridge、标题栏 |
+| `internal/app` | bridge 方法表与事件 |
+| `internal/mdscan` | Markdown 扫描与按字节替换 |
+| `internal/imgpath` | 图片地址分类与解析 |
+| `internal/picgo` | PicGo 上传客户端 |
+| `internal/conv` | 转换流水线 |
+| `internal/remoteimg` | 远程图片检测与下载 |
+| `internal/remotecache` | 下载缓存 |
+| `internal/uploadcache` | 上传缓存 |
+| `internal/settings` | 设置读写 |
+| `internal/platform` | 原生对话框、ANSI 代码页 |
+| `internal/update` | 更新检查与安装 |
+| `internal/ui` | 前端产物(`go:embed`) |
+| `web` | Vue 3 + TypeScript + Vite 前端 |
+| `scripts` | 构建、启动、测试脚本 |
+| `tools/bench` | 基准测试 |
+| `tools/mockpicgo` | 假图床 |
+
+图标资源在 `assets/`;常规构建直接使用已提交的 `.ico` 和 `.syso`,不需要重新生成。
+
+## 分支与发版
+
+- 开发在 `dev` 上进行,`main` 只接受来自 `dev` 的合并,由分支规则强制。
+- 合并到 `main` 会触发「构建并发布」。只有改动落在 `cmd/`、`internal/`、`web/`、
+  `scripts/`、`assets/`、`tools/`、`go.mod`、`go.sum`、`package.json` 时才会发版——
+  纯文档的合并不发版。
+- 版本号就是发布当天的日期(CalVer,`Asia/Shanghai`);同一天第二次发布顺延成
+  `2026.11.17.1`,靠 tag 探测,不落状态。
+- 提交标题里带 `[no-release]` 时照常构建和跑测试,但不发布。
+- 发布产物是 exe 加 `version.json`——客户端靠这份清单发现更新。整个流程不往仓库里推东西。
+- 更新说明由 `scripts/release-notes.mjs` 从上一次 tag 到现在的提交生成。本地预览:
+
+```bash
+npm run notes -- --version 2026.11.17 --dry-run
+```
+
+「同步 main 到 dev」会在每次合并后把 `main` 合回 `dev`;「主从同步检查」会拦住
+来源分支未包含最新 `main` 的 PR。
diff --git a/docs/usage.md b/docs/usage.md
new file mode 100644
index 0000000..91e3bda
--- /dev/null
+++ b/docs/usage.md
@@ -0,0 +1,87 @@
+# Usage
+
+[English](usage.md) | [简体中文](usage.zh-CN.md) · back to [README](../README.md)
+
+## The three jobs
+
+| Job | What it touches | Rewrites the document | Needs PicGo running |
+| --- | --- | --- | --- |
+| Upload | local images → image host | yes | yes |
+| Check | remote image URLs | no | no |
+| Download | remote images → `images/` | yes | no |
+
+- **Upload** leaves the remote images an article already has exactly as they are.
+- **Check** is read-only, but it also flags local images the document references and
+  the disk no longer has.
+- **Download** only touches remote images; local ones are left alone.
+
+Drop files or a whole folder, watch the queue, cancel mid-run, retry failures, filter
+down to problems only, and expand any row for per-image details. The same image is
+never uploaded twice, and an unchanged image that was already uploaded or downloaded
+is reused from cache.
+
+## Output modes
+
+| Mode | Result |
+| --- | --- |
+| sidecar (default) | writes `note.converted.md`; the original is untouched |
+| in-place | rewrites the original, after backing it up to `note.md.bak` |
+| directory | writes into a folder you choose; duplicate names get a numeric suffix, nothing is overwritten |
+
+## Supported syntax
+
+```markdown
+![image](images/a.png)
+![image](images/a.png "title")
+![image]()
+![](images/has(parens).png)
+
+
+
+![full][ref1]  ![collapsed][]  ![shortcut]
+[ref1]: images/a.png
+```
+
+- Reference-style images, HTML `src` / `srcset` / ``, several images on one
+  line, and paths with spaces or parentheses all work.
+- Remote images, `data:` URIs, missing local files, and attachments such as
+  `.ps` / `.eps` / `.pdf` / `.ai` / `.psd` / `.sketch` / `.fig` / `.drawio` are left
+  alone.
+- Images inside fenced code blocks, inline code, HTML comments, `
` and ``
+  are never touched.
+
+## Encoding
+
+Documents are read and written in their original encoding: UTF-8 (with or without a
+BOM), UTF-16 with a BOM, and the machine's ANSI code page. Inside the program
+everything is UTF-8, but a document is only accepted when it converts back to the
+exact bytes it came from — so nothing outside the rewritten image addresses can drift.
+
+## Settings
+
+PicGo address, concurrency, retry count; whether to reuse previous upload/download
+results; output mode, output folder, sidecar suffix, remote-image folder; theme
+(light / dark / follow system); language (Chinese / English); what closing the window
+does (ask, minimize to tray, quit) and whether to start minimized to the tray.
+
+## Data directory
+
+Next to the executable by default:
+
+```text
+MarkPic.exe
+data/
+  settings.json
+  upload-cache.json
+  remote-cache.json
+  webview2/
+```
+
+On Windows, if that folder is not writable MarkPic falls back to `%APPDATA%\markpic`. Set
+`MARKPIC_DATA_DIR` to point somewhere else.
+
+## Updating
+
+An installed copy reads the version manifest published with each release and offers
+the update in the About panel. Developer builds (`+dev`) skip the check. If you want a
+self-hosted mirror, point `MARKPIC_UPDATE_MANIFEST` at your own `version.json`.
diff --git a/docs/usage.zh-CN.md b/docs/usage.zh-CN.md
new file mode 100644
index 0000000..8acba03
--- /dev/null
+++ b/docs/usage.zh-CN.md
@@ -0,0 +1,77 @@
+# 使用说明
+
+[English](usage.md) | [简体中文](usage.zh-CN.md) · 返回 [README](../README.zh-CN.md)
+
+## 三种作业
+
+| 作业 | 处理什么 | 会改文档吗 | 需要 PicGo 开着 |
+| --- | --- | --- | --- |
+| 上传 | 本地图片 → 图床 | 会 | 是 |
+| 检测 | 网络图片地址 | 不会 | 否 |
+| 下载 | 网络图片 → `images/` | 会 | 否 |
+
+- **上传**:文章里原有的远程图片原样保留。
+- **检测**:只读,但也会指出「文档引用了、磁盘上却不存在」的本地图。
+- **下载**:只处理远程图,本地图保留。
+
+拖入文件或整个文件夹,看队列、中途取消、失败重试、只看问题,每张图的明细可以展开。
+同一张图只上传一次;已经上传/下载过且内容未变的图直接复用。
+
+## 输出方式
+
+| 模式 | 结果 |
+| --- | --- |
+| sidecar(默认) | 生成 `note.converted.md`,原文件不动 |
+| in-place | 改写原文件,先备份成 `note.md.bak` |
+| directory | 写到指定目录;同名文件自动加序号,不覆盖已有文件 |
+
+## 支持的写法
+
+```markdown
+![图片](images/a.png)
+![图片](images/a.png "标题")
+![图片]()
+![](images/有(括号).png)
+
+
+
+![完整][ref1]  ![折叠][]  ![简写]
+[ref1]: images/a.png
+```
+
+- 支持引用式图片、HTML `src` / `srcset` / ``、一行多图、带空格或括号的路径。
+- 跳过远程图、`data:`、缺失的本地文件,以及 `.ps` / `.eps` / `.pdf` / `.ai` /
+  `.psd` / `.sketch` / `.fig` / `.drawio` 这类附件。
+- 代码块、行内代码、HTML 注释、`
` / `` 里的图片不处理。
+
+## 编码
+
+文档按原编码读入、按原编码写回:UTF-8(含或不含 BOM)、带 BOM 的 UTF-16、以及本机
+ANSI 代码页。程序内部统一是 UTF-8,但只有「能逐字节转回原文」的文档才会被接受——
+所以除了被替换掉的图片地址,其余内容不可能发生漂移。
+
+## 设置
+
+PicGo 地址、并发数、重试次数;是否复用上次的上传/下载结果;输出方式、输出目录、
+sidecar 后缀、远程图存放目录;主题(亮色 / 暗色 / 跟随系统);语言(中文 / 英文);
+关闭窗口时询问、最小化到托盘还是直接退出;是否启动时进入托盘。
+
+## 数据目录
+
+默认在 exe 旁边:
+
+```text
+MarkPic.exe
+data/
+  settings.json
+  upload-cache.json
+  remote-cache.json
+  webview2/
+```
+
+Windows 上该目录不可写时会退回 `%APPDATA%\markpic`;也可以用环境变量 `MARKPIC_DATA_DIR` 指定别处。
+
+## 更新
+
+已安装的版本会读每次发布随包上传的版本清单,在「关于」里提示更新;`+dev` 的开发构建
+不检查更新。想自建镜像的话,把 `MARKPIC_UPDATE_MANIFEST` 指向你自己的 `version.json`。
diff --git a/package.json b/package.json
index ab5ccdb..b08282f 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
   "name": "markpic",
   "private": true,
   "repository": { "type": "git", "url": "https://github.com/geekMus/MarkPic.git" },
-  "description": "MarkPic:把 Markdown 里的图片收进图床(Go + 原生窗口 + Vue 3 界面,纯桌面程序)",
+  "description": "Markdown image manager: upload local images to your PicGo host, check or download the remote ones. No installer, no local server, no command line.",
   "//": "任务入口:Node 脚本跨平台,真正的依赖在 web/package.json;需要 Node 20.19+。",
   "engines": { "node": ">=20.19" },
   "scripts": {