Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
8e6e6bd
重构:操作类型与设置分离,统计数字统一由后端下发
geekMus Nov 19, 2026
acfc0a3
重构:缓存持久化合并成一份实现,修几处启动期开销
geekMus Nov 19, 2026
a869d01
拖放:原生接管放置目标,文档按内容识别
geekMus Nov 19, 2026
31af86f
队列:拖入文件夹就地展开成逐份文档的卡片
geekMus Nov 19, 2026
f8779f4
文件夹展开:所有文本文件都算文档,不再按 Markdown 结构过滤
geekMus Nov 19, 2026
b046925
扫描:边遍历边上报进度,去掉总时长上限,支持随时停止
geekMus Nov 19, 2026
7d1dcd2
核验源码并重写 README:修三处真问题,加截图
geekMus Nov 19, 2026
96745e1
仓库:补 MIT 许可证
geekMus Nov 20, 2026
1d17516
文档:中英 README 各配各语言的界面截图
geekMus Nov 20, 2026
51f52fb
扫描:结果攒到收尾一次铺开,文件夹卡片可展开看详情;文档改用亮色截图
geekMus Nov 20, 2026
3ef5aab
扫描:只收 Markdown,空文件也算;修「两个 md 只出一个」
geekMus Nov 20, 2026
ce609f3
界面:卡片右侧的徽标 / 详情 / 图标按钮统一成一条 24px 基线
geekMus Nov 20, 2026
f50e2a0
扫描:实时显示「此刻正在读的那个目录」
geekMus Nov 20, 2026
3749f4d
扫描:显示到「正在解析的那份文件」,并把速度提上来(1 万份 1.5s → 0.27s)
geekMus Nov 20, 2026
c75897e
扫描改成两段:文件夹先「发现」,确认导入后再统计;启动永远是全新状态
geekMus Nov 20, 2026
266a8c9
扫描:修拖整盘卡死;扫描卡片不再算任务,文件清单只在展开时显示
geekMus Nov 21, 2026
a4cadd9
控制台日志乱码:改用 WriteConsoleW 按 UTF-16 写终端
geekMus Nov 21, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions .github/workflows/cleanup-obsolete-workflow-runs.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
name: 清理废弃工作流记录

on:
# 只保留手动触发:这是给 4 个工作流的仓库用的清理工具,不值得每天自动跑一遍。
workflow_dispatch:
schedule:
# 每天北京时间 05:00。修改 cron 可更改运行时间,修改 timezone 可更改时区。
- cron: "0 5 * * *"
timezone: "Asia/Shanghai"

permissions:
actions: write
Expand Down
115 changes: 1 addition & 114 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# - 清单不再写回 main(main 只接受来自 dev 的合并,CI 推不进去),而是作为 release
# 附件上传;客户端读 releases/latest/download/version.json。
#
# 分层(与 PacPilot 的 workflow 同一套写法:每层一个 job,末尾写「阶段 N 小结」进 Job Summary):
# 分层(与 PacPilot 的 workflow 同一套写法:每层一个 job,小结统一放在最后的 report job):
# 阶段 1 prepare:算版本号、判断这次要不要发
# 阶段 2 build :装依赖 → 构建前端 → Go 测试 → 编译 exe → 上传 artifact
# 阶段 3 publish:生成更新说明 → 生成版本清单 → 建草稿 → 传 exe 与清单 → 发布
Expand Down Expand Up @@ -120,32 +120,6 @@ jobs:
echo "产物名称:$ASSET"
echo "发布判断:$REASON"

- name: 阶段 1 小结
if: always()
env:
JOB_STATUS: ${{ job.status }}
VERSION: ${{ steps.version.outputs.version }}
ASSET: ${{ steps.version.outputs.asset }}
PUBLISH: ${{ steps.version.outputs.publish }}
REASON: ${{ steps.version.outputs.reason }}
shell: bash
run: |
{
echo "## 阶段 1:版本号与发布判断"
echo
echo "- **结果:** ${JOB_STATUS:-未知}"
echo "- **目标版本:** ${VERSION:+v}${VERSION:-未算出}"
echo "- **产物名称:** ${ASSET:-未确定}"
if [[ "${PUBLISH:-}" == "true" ]]; then
echo "- **发布决策:** 允许进入构建与发布阶段"
elif [[ "${PUBLISH:-}" == "false" ]]; then
echo "- **发布决策:** 本次只构建不发布([no-release])"
else
echo "- **发布决策:** 未能完成判断,请查看上方日志"
fi
echo "- **说明:** ${REASON:-阶段未产生判断结果,详见日志}"
} >> "$GITHUB_STEP_SUMMARY"

build:
name: 构建安装包
needs: prepare
Expand Down Expand Up @@ -245,50 +219,6 @@ jobs:
if-no-files-found: error
retention-days: 1

- name: 阶段 2 小结
if: always()
env:
JOB_STATUS: ${{ job.status }}
VERSION: ${{ needs.prepare.outputs.version }}
ASSET: ${{ needs.prepare.outputs.asset }}
CHECKOUT: ${{ steps.checkout.outcome }}
GO: ${{ steps.setup-go.outcome }}
PNPM: ${{ steps.setup-pnpm.outcome }}
NODE: ${{ steps.setup-node.outcome }}
INSTALL: ${{ steps.install.outcome }}
WEB: ${{ steps.web.outcome }}
TESTS: ${{ steps.tests.outcome }}
BUILD: ${{ steps.build.outcome }}
VERIFY: ${{ steps.verify.outcome }}
UPLOAD: ${{ steps.upload.outcome }}
SIZE: ${{ steps.verify.outputs.size }}
SHA256: ${{ steps.verify.outputs.sha256 }}
shell: bash
run: |
{
echo "## 阶段 2:构建安装包"
echo
echo "- **结果:** ${JOB_STATUS:-未知}"
echo "- **目标版本:** ${VERSION:+v}${VERSION:-未确定}"
echo "- **产物名称:** ${ASSET:-未确定}"
echo "- **产物大小:** ${SIZE:-未生成} 字节"
echo "- **产物 SHA256:** ${SHA256:-未生成}"
echo
echo "### 步骤结果"
echo
echo "- **检出代码:** ${CHECKOUT:-未执行}"
echo "- **Go / pnpm / Node:** ${GO:-未执行} / ${PNPM:-未执行} / ${NODE:-未执行}"
echo "- **安装前端依赖:** ${INSTALL:-未执行}"
echo "- **构建前端:** ${WEB:-未执行}"
echo "- **Go 测试:** ${TESTS:-未执行}"
echo "- **编译 exe:** ${BUILD:-未执行}"
echo "- **校验产物 / 上传:** ${VERIFY:-未执行} / ${UPLOAD:-未执行}"
if [[ "${JOB_STATUS:-}" != "success" ]]; then
echo
echo "- **排查建议:** 在「步骤结果」里找出第一个非 success 的步骤,只看那一段日志;发布阶段不会执行。"
fi
} >> "$GITHUB_STEP_SUMMARY"

publish:
name: 发布 Release
needs: [prepare, build]
Expand Down Expand Up @@ -410,49 +340,6 @@ jobs:
gh release edit "$TAG" --draft=false
echo "已发布 $TAG(exe + version.json)"

- name: 阶段 3 小结
if: always()
env:
JOB_STATUS: ${{ job.status }}
VERSION: ${{ needs.prepare.outputs.version }}
TAG: ${{ needs.prepare.outputs.tag }}
ASSET: ${{ needs.prepare.outputs.asset }}
PREVIOUS: ${{ steps.notes.outputs.previous }}
FEATURES: ${{ steps.notes.outputs.features }}
IMPROVES: ${{ steps.notes.outputs.improves }}
FIXES: ${{ steps.notes.outputs.fixes }}
DOWNLOAD: ${{ steps.download.outcome }}
NOTES: ${{ steps.notes.outcome }}
MANIFEST: ${{ steps.manifest.outcome }}
RELEASE: ${{ steps.release.outcome }}
PUBLISH: ${{ steps.publish.outcome }}
shell: bash
run: |
{
echo "## 阶段 3:发布 Release"
echo
echo "- **结果:** ${JOB_STATUS:-未知}"
echo "- **版本 / 标签:** v${VERSION:-未确定} / ${TAG:-未确定}"
echo "- **产物:** ${ASSET:-未确定}"
echo "- **上一个 tag:** ${PREVIOUS:-未获取}"
echo "- **记录分组:** 新功能 ${FEATURES:-0} 项 / 改进 ${IMPROVES:-0} 项 / 修复 ${FIXES:-0} 项"
echo
echo "### 步骤结果"
echo
echo "- **下载安装包:** ${DOWNLOAD:-未执行}"
echo "- **生成更新说明:** ${NOTES:-未执行}"
echo "- **生成版本清单:** ${MANIFEST:-未执行}"
echo "- **建草稿 release:** ${RELEASE:-未执行}"
echo "- **上传并发布:** ${PUBLISH:-未执行}"
if [[ "${JOB_STATUS:-}" == "success" ]]; then
echo
echo "- **说明:** 客户端读的是 Release 附件 version.json(releases/latest/download/version.json),不再依赖 main 分支上的文件。"
else
echo
echo "- **注意:** 草稿 release 不会被客户端看到;修好之后重跑,或者去 Releases 页面把草稿删掉。"
fi
} >> "$GITHUB_STEP_SUMMARY"

report:
name: 汇总结果
needs: [prepare, build, publish]
Expand Down
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 geekMus

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
136 changes: 106 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,53 +1,129 @@
# MarkPic

[English](README.md) | [简体中文](README.zh-CN.md)
**The image pipeline for Markdown documents.** Drop a document or a folder, pick one of
three jobs, and MarkPic rewrites the image links — or tells you which ones are broken.

MarkPic is a desktop app for the images inside Markdown documents. It does three
independent jobs:
[![release](https://img.shields.io/github/v/release/geekMus/MarkPic?display_name=tag)](https://github.com/geekMus/MarkPic/releases)
![platform](https://img.shields.io/badge/platform-Windows%2010%2B-0078D6)
![license](https://img.shields.io/badge/license-MIT-blue)

- **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.
[English](README.md) | [简体中文](README.zh-CN.md)

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.
![The upload page: three documents in the queue, one expanded to show every rewritten link](docs/images/en/upload.png)

## At a glance
## 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** | local images → your image host | yes | yes |
| **Check** | remote image URLs | no | no |
| **Download** | remote images → `images/` | yes | no |

- **Upload** finds the local images a document references, sends them through your
[PicGo](https://github.com/Molunerfinn/PicGo) server, and rewrites each link to the hosted
URL. Remote images already in the article are left alone.
- **Check** walks the remote URLs and reports the ones that are dead, are not images, or come
back truncated. Read-only.
- **Download** pulls those remote images into a local `images/` folder and rewrites the links
to relative paths.

A document that needs none of this still stops by for a visit — it appears in the queue with
“no images”, so the number of cards always matches the number of documents in the folder.

## What it looks like

### Check: which links are dead

![Check page: 4 addresses, 2 open, 2 dead](docs/images/en/check.png)

### Download: remote images, brought home

![Download page: 2 remote images fetched](docs/images/en/download.png)

### Folders: find the Markdown first, import when ready

Dropping a folder or a whole drive gives you one **scan card**. It only looks for Markdown
files — it never opens them — so it is fast and completely predictable. The card counts what
it has found, shows the directory being walked and how long it has been running, and can be
stopped at any time. When it finishes, expand the card to see the Markdown files it found.

Click **Import** on that card: it is replaced by one card per document, and the image counts
are filled in afterwards. That second pass is throttled to what the machine can handle — never
ten thousand scans at once.

![A folder has been scanned: 3 documents found, ready to import](docs/images/en/scanning.png)

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.
### Settings: everything in one page, saved when you are done

![Settings page](docs/images/en/settings.png)

### Light and dark

Every screenshot on this page uses the light theme. MarkPic follows the system theme by
default; **Settings → Theme** pins it to light or dark. The native title bar, the tray menu
and the WebView background switch together, so resizing or repainting never flashes white.

![Dark theme](docs/images/en/dark.png)

## Features

- **Drop files, several files, or a folder.** A single file becomes a file card right away.
A folder or drive becomes a scan card that only finds Markdown (`.md`, `.markdown`,
`.mdown`, `.mkd`, `.mdwn`); click **Import** to turn what it found into file cards. A
document with no images still gets a card — even an empty one — so the queue always matches
the folder. `.txt`, code files, images and archives are ignored.
- **Fresh every launch.** Closing and reopening the app always starts on the first page with
an empty queue. Switching between Upload, Check and Download inside a running session keeps
each page's queue and results.
- **Byte-faithful rewriting.** UTF-8 (with or without BOM), UTF-16 with BOM and the machine's
ANSI code page all survive the round trip; apart from the rewritten addresses the file comes
back identical.
- **Never uploads the same image twice.** Identical content is uploaded once per run, and an
unchanged image that was uploaded or downloaded before is reused from cache.
- **Three output modes.** Sidecar copy (`note.converted.md`), in place (with a `.bak`), or
into a directory you choose.
- **Desktop manners.** Tray icon, close-to-tray, light/dark theme that follows the system,
Chinese and English UI, and self-update from GitHub releases.
- **No local server, no runtime, no credentials.** The UI is embedded in the executable;
uploads go through PicGo's local HTTP interface, so MarkPic never sees your image-host keys.

## Install

Download `MarkPic-v<version>-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.
[Releases](https://github.com/geekMus/MarkPic/releases). There is no installer: put it
anywhere and run it. An installed copy updates itself, and settings plus 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.
Windows 10 or newer. macOS and Linux are planned but not verified yet.

## Quick start

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.
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 your documents, or a folder, onto the MarkPic window.
3. Choose **Upload**, **Check** or **Download** on the left, then start.

## Documentation

- [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
- [Bridge API](docs/API.md) — the internal WebView2 bridge between the UI and Go

## Build from source

Requires Go 1.24+. Changing the UI also needs Node 20.19+ and pnpm; the build scripts run
`pnpm --dir web install` for you. One command builds the frontend and produces
`bin/MarkPic.exe`:

```bash
npm run build
```

See [docs/build.md](docs/build.md) for the scripts, the release workflow and the repository
layout.

## License

MIT — see [LICENSE](LICENSE). Bundled third-party code keeps its own license:
[go-webview2](https://github.com/jchv/go-webview2) (MIT) and
[golang.org/x/sys](https://pkg.go.dev/golang.org/x/sys) (BSD-3-Clause).
Loading