Upload pics automatically via Typora

Well, my last post met some problem that the picture of my beautiful console can not be seen.

I find the Typora can automatically upload every pic now. It gives a custom command for me to config.

My personal server now gets some problems in configuring the https road. So I'll note the method here. After I solve the problem of the server, I'll configure a .sh file to automatically upload the pics in the markdown file, and then my website will successfully show them.

I really really hope in the future I won't forget these things.

Upload pics automatically via Typora

Custom

You could config a custom command to upload images, using tools that is not listed in above options, or event write your own tools / scripts. Typora will append all images that needs to be uploaded after the custom command you filled.

Then, Typora will fetch image urls from the last N lines of the standard output of your custom command. (N is the number of images to upload).

For example, if you write a tool upload-image.sh, then you can input [some path]/upload-image.sh in the command filed. Typora will call [some path]/upload-image.sh "image-path-1" "image-path-2" to upload two images located in image-path-1 and image-path-2. Then the command may return something like:

1
2
3
Upload Success:
http://remote-image-1.png
http://remote-image-2.png

Then Typora will get the two remote image url from the output, and replace the original local images used in the Markdown document.

You could click the “Test Uploader” button to verify your custom commands.

Use current filename / filepath in custom commands

You can use ${filename} and ${filepath} in your custom commands, they will be replace as the current markdown file name and current file path. For “untitled” files that have not been saved on your disk, they will be empty strings.