美文网首页
解决Typora(md书写工具)图片上传问题

解决Typora(md书写工具)图片上传问题

作者: caokai001 | 来源:发表于2020-01-20 23:11 被阅读0次

    问题来源:

    当你接触过markdown 就会被它书写方式所吸引,目前人为最方便的编辑工具是Typora,
    唯一槽点:无法直接上传到图床 (目前有些工具,专门用于图片上传服务器,比如: PicGO).
    如果存在一个插件,可以直接粘贴到typora里面,自动上传到github图床就完美了。

    突然发现了一个大佬为typora写的插件. typora-plugins-win-img


    1.安装typora

    安装教程环境说明:

    • typora版本:0.9.68 (Windows x86) (去下载
    • typora安装目录:C:\Program Files (x86)\Typora ,可以安装在其他目录

    2.安装插件

    安装步骤:

    1. 下载插件代码;
    2. 复制插件相关代码文件:window.htmlplugins
    3. 将复制的插件代码文件,粘贴到typora安装目录下的 resources\app 文件夹下;
    4. 安装完成,重启typora,就可以了

    3.修改图片上传位置

    默认会上传到 街边价 ,可以修改成github, 腾讯云.

    更换图片上传接口地址,打开 plugins/image/upload.js 文件,拉到最下面 将最后一行的 $.image.init(); 按照下面的说明进行配置:

    上传到Github——推荐:

    //注册token的尽量不要跟其他应用共用,同时授予最小权限
    //免费+无需自己搭建服务器,是一种不错的方式
    $.image.init({
        target:'github',
        github:{
            Token : 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', // 添加一个仅给typora使用的token 授予最小的权限(repo.public_repo) ,添加token:https://github.com/settings/tokens
            CommitterName : 'nickname',                         // 提交人昵称,写你github的昵称
            CommitterEmail : 'email@mail.com',                  // 提交人邮箱,写你github的邮箱
            Repository : 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',      // github项目名,比如你的项目地址是:https://github.com/Thobian/typora-plugins-win-img  那就是后面的“Thobian/typora-plugins-win-img”
            Filepath : 'typora',                                // 图片在项目中的保存目录,可以不用提前创建目录,github提交时发现没有会自动创建
        }
    });
    
    

    4.效果

    设置图床地址为github后,在Typora中直接粘贴就可以自动上传.


    image.png

    目前支持其他的图床服务器,具体请参考 https://github.com/Thobian/typora-plugins-win-img
    知乎话题

    相关文章

      网友评论

          本文标题:解决Typora(md书写工具)图片上传问题

          本文链接:https://www.haomeiwen.com/subject/lbjszctx.html