{"id":13455177,"url":"https://github.com/jarvanstack/markpic","last_synced_at":"2026-01-29T07:49:40.965Z","repository":{"id":63456912,"uuid":"567647088","full_name":"jarvanstack/markpic","owner":"jarvanstack","description":"一键下载 markdown 中图片, 并通过 picgo 上传图片到图床并替换链接","archived":false,"fork":false,"pushed_at":"2023-10-16T06:22:54.000Z","size":71,"stargazers_count":55,"open_issues_count":0,"forks_count":4,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-10-28T22:35:14.058Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jarvanstack.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2022-11-18T08:49:20.000Z","updated_at":"2024-08-25T17:53:02.000Z","dependencies_parsed_at":"2024-01-13T17:33:00.610Z","dependency_job_id":"51cc44de-f676-4a04-a314-8a334d841370","html_url":"https://github.com/jarvanstack/markpic","commit_stats":null,"previous_names":["dengjiawen8955/du","jarvanstack/markpic"],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jarvanstack%2Fmarkpic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jarvanstack%2Fmarkpic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jarvanstack%2Fmarkpic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jarvanstack%2Fmarkpic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jarvanstack","download_url":"https://codeload.github.com/jarvanstack/markpic/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245227573,"owners_count":20580898,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T08:01:02.102Z","updated_at":"2026-01-29T07:49:40.954Z","avatar_url":"https://github.com/jarvanstack.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n\u003cimg src=\"logo.png\" width=\"200px\"/\u003e\n\u003cbr\u003e\n\u003cp align=\"center\"\u003e\n \u003cimg src=\"https://img.shields.io/github/stars/jarvanstack/markpic\" /\u003e\n \u003cimg src=\"https://img.shields.io/github/issues/jarvanstack/markpic\" /\u003e\n \u003cimg src=\"https://img.shields.io/github/forks/jarvanstack/markpic\" /\u003e\n\u003c/p\u003e\n\u003c/p\u003e\n\n# markpic\n\n一键将 markdown 中的所有图片下载到本地, 并通过 picgo 上传到图床\n\n\n## 安装\n\n(1) 方法1 通过 go install 直接安装\n\n```bash\ngo install github.com/jarvanstack/markpic@latest\n```\n\n(2) 方法2 下载编译好的二进制文件并放到 PATH 中\n\n下载地址: \u003chttps://github.com/jarvanstack/markpic/releases\u003e\n\n## 使用\n\n```bash\n# 一键将 markdown 中的所有图片下载到本地, 并通过 picgo 上传到图床\nmarkpic test.md\n```\n\n```bash\n$ markpic --help\n一键将 markdown 中的所有图片下载到本地, 并通过 picgo 上传到图床\n\nUsage:\n  markpic [command] [flags]\n  markpic [command]\n\nAvailable Commands:\n  completion  Generate the autocompletion script for the specified shell\n  d           将 markdown 中的图片下载到本地\n  du          先 d(下载) 再 u(上传)\n  help        Help about any command\n  u           将 markdown 中的所有本地图片通过 picgo 上传到图床\n\nFlags:\n  -d, --dir string    图片存放的目录 (default \"images/\")\n  -f, --from string   需要处理的源文件 (default \"source.md\")\n  -h, --help          help for markpic\n\nUse \"markpic [command] --help\" for more information about a command.\n```\n\n## 使用实例\n\n我们在 windows 有一个 markdown 文件 test.md\n\n```markdown\n六边形架构\n\n![](https://cdn.nlark.com/yuque/0/2022/png/2397010/1668752212281-41b93ae1-c4c0-4af4-befa-ceaf1f4efb05.png#averageHue=%23f9f9f8\u0026clientId=u39f9e662-ddb8-4\u0026crop=0\u0026crop=0\u0026crop=1\u0026crop=1\u0026from=paste\u0026id=u7149c748\u0026margin=[object Object]\u0026originHeight=279\u0026originWidth=448\u0026originalType=url\u0026ratio=1\u0026rotation=0\u0026showTitle=false\u0026status=done\u0026style=none\u0026taskId=u7e969d8b-9118-433a-86db-806375faecf\u0026title=)\n\n```\n\n* 里面的网络图片因为防盗链机制, 无法再其他博客平台上同步\n* 即使在 typroa 中设置插入图片时候对网络位置的图片上传也无法上传\n\n![无法上传](https://cdn.jarvans.com/blog/2023/2022-02-0420221119171918.png)\n\n* 所以我们需要将图片下载到本地, 然后再上传到图床\n* 但是这个操作如果图片比较多的话比较繁琐, 而且容易遗漏\n* 现在 **markpic 可以帮助我们一键将 markdown 中的所有图片下载到本地, 并通过 picgo 上传到图床**\n\n```bash\nPS C:\\c_code\\markpic\u003e markpic  test.md\n[下载-上传]\n[下载-上传完成] .\\test.md.download.md .\\test.md.upload.md\n```\n\ntest.md.download.md 内容如下\n\n```markdown\n六边形架构\n\n![image.png](C:\\c_code\\markpic\\images\\)\n\n```\n\ntest.md.upload.md 内容如下\n\n```markdown\n六边形架构\n\n![image.png](https://myweb/1_1668752375501-1bb18730-73da-421a-8c35-de8d29029919.png.png)\n\n```\n\n因为自己搭建的图床没有防盗链机制, 所以可以直接在其他平台同步\n\n## 注意\n\n* 该程序调用 PicGo 客户端的接口上传图片, 使用前需要下载 PicGo 客户端并配置好图床, 保持 PicGo 客户端正常运行\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjarvanstack%2Fmarkpic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjarvanstack%2Fmarkpic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjarvanstack%2Fmarkpic/lists"}