How to use Typora efficiently on Ubuntu


How to use Typora efficiently on Ubuntu

Environment

image-20211125161129921

What we need?

  • Typora —— a markdown editor
  • Picgo-Core —— a tool for image uploading
  • gitee repository —— images repository

Get your personal token for gitee repository

Don't forget to save it(gitee personal token) in your device.

image-20211125165934161

Installation for Picgo-Core

Before installing Picgo-Core, we need to install Nodejs.

Installation for Nodejs

# install nodejs and npm
sudo apt install nodejs -y
sudo apt install npm -y

# check installation result
node -v
npm -v

Installation for Picgo-Core

# install cnpm
sudo npm install -g cnpm

# before installing Picgo-Core, we need use an image source for npm to accelarate downloading
npm install express --registry=https://registry.npm.taobao.org

# use cnpm to install Picgo-Core
sudo cnpm install picgo -g

Installation for picgo-plugin-gitee-uploader

# install gitee-uploader plugin
picgo install gitee-uploader

Picgo-Core Configuration

# enter the root of picgo configuration file
cd ~/.picgo/

# modify the configuration of config.json
vim config.json

config.json

{
  "picBed": {
    "current": "gitee",
    "uploader": "gitee",
    "smms": {
      "token": ""
    },
    "gitee": {
      "message": "added a picture",
      "owner": "gitee_username",
      "branch": "master",
      "path": "images_folder_path",
      "repo": "gitee_username/repository_name",
      "token": "personal token for gitee repository"
    }
  },
  "picgoPlugins": {
    "picgo-plugin-gitee-uploader": true
  },
  "picgo-plugin-gitee-uploader": {
    "lastSync": "2021-11-25 04:11:52"
  }
}

Installation for Typora

Installation

# get public-key
wget -qO - https://typora.io/linux/public-key.asc | sudo apt-key add -

# add Typora's repository
sudo add-apt-repository 'deb https://typora.io/linux ./'
sudo apt-get update

# install typora
sudo apt-get install typora

Configuration

Use Custom Command Mode to upload image to gitee repository by Picgo-Core

# set uploading instruction 
/usr/local/lib/nodejs/bin/node /usr/lib/node_modules/picgo/bin/picgo upload

image-20211125163943606

Then, let's verify the availability of uploading service..

image-20211125165551264

Now, you can enjoy the convenience of automatic image uploading service.