Typora安装PicGoCore并将Gitee为图床

时间:2021-09-20
本文章向大家介绍Typora安装PicGoCore并将Gitee为图床,主要包括Typora安装PicGoCore并将Gitee为图床使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

我这里采用全局安装picgo的方法,不采用typora内置安装的方法,可以作为参考

PicGoCore官方参考文档

建Gitee仓库

一定要开源,否则在typora中加载不出来

1、安装node.js环境

网上有好多就不介绍了,要配置好环境变量,好像安装的时候,有一个选择的地方勾选path就会自动帮你配置

2、下载安装picgo

npm intall picgo -D

这个会安装在C:\Users\{你电脑用户名}\AppData\Roaming\npm

3、安装gitee插件

picgo install gitee-smart 
#这里不需要完整npm包名,只需要后面不同的部分,完整是这样的picgo-plugin-gitee-smart

关于安装插件的install命令的说明

自行去npm仓库查找picgo插件

4、配置文件

这个配置文件是我从PicGoApp中复制出来的,可能存在冗余

将这个配置文件复制到C:\Users\{电脑用户名}\.picgo\config.json

{
  "picBed": {
    "current": "gitee",
    "uploader": "gitee",
    "smms": {
      "token": ""
    },
    "list": [
      {
        "name": "SM.MS图床",
        "type": "smms",
        "visible": false
      },
      {
        "name": "腾讯云COS",
        "type": "tcyun",
        "visible": false
      },
      {
        "name": "GitHub图床",
        "type": "github",
        "visible": false
      },
      {
        "name": "七牛图床",
        "type": "qiniu",
        "visible": false
      },
      {
        "name": "Imgur图床",
        "type": "imgur",
        "visible": false
      },
      {
        "name": "阿里云OSS",
        "type": "aliyun",
        "visible": false
      },
      {
        "name": "又拍云图床",
        "type": "upyun",
        "visible": false
      },
      {
        "name": "gitee",
        "type": "gitee",
        "visible": true
      }
    ],
    "gitee": {
      "branch": "master",
      "customPath": "yearMonth",
      "customUrl": "",
      "path": "",
      "repo": "用户路径/仓库路径",
      "token": "gitee令牌"
    }
  },
  "settings": {
    "shortKey": {
      "picgo:upload": {
        "enable": true,
        "key": "CommandOrControl+Shift+P",
        "name": "upload",
        "label": "快捷上传"
      }
    },
    "server": {
      "port": 36677,
      "host": "127.0.0.1",
      "enable": true
    },
    "privacyEnsure": true,
    "showUpdateTip": false,
    "pasteStyle": "markdown",
    "autoStart": true,
    "autoRename": true,
    "rename": false
  },
  "picgoPlugins": {
    "picgo-plugin-gitee-uploader": true,
    "picgo-plugin-gitee-smart": true
  },
  "debug": true,
  "PICGO_ENV": "GUI",
  "needReload": false,
  "picgo-plugin-gitee-uploader": {
    "lastSync": "2021-09-20 11:34:41"
  }
}

需要配置的部分

*01、获取令牌配置到token中

选择这两项权限就够了

*02、获取仓库路径配置到repo

我这里是yi0618/tymaekdown

5、配置插件

picgo use uploader

用↑↓选择gitee

6、配置Typora

配置

验证

7、一些注意

  • 上传的图片不可以重名,否则会上传失败,尽量使用Snipaste等可以根据时间命名图片的截图工具

  • 图片上传后还会在本地保存一份在C:\Users\{你的电脑用户名}\AppData\Roaming\Typora\typora-user-images可以根据这个来计算仓库是否满了(可以查看一下gitee的存储规则,好像单个仓库不可以超过1g),我用Snipaste截图500张不到40M,应该可以存10000张左右吧,算挺多的。

  • 好像typora自带的picgoCore也可以这么配置吧,这个方法成功了不想折腾了

  • 个人建议到官方文档去看怎么安装,虽然可能文档比较复杂,但是各种说明比较清晰。

原文地址:https://www.cnblogs.com/yarion/p/15314206.html