在Typora中永久插入图片
Typora这个编辑器还可以,之前个人觉得最大的缺点是图片,因为是在内网离线编辑,只要离开的导入的目录路径就会找不到;还有一种是网上的图片的url链接,但这种也有风险会找不到。
之前转给别人的唯一方式就是导出成PDF,但是最近发现别人通过base64的方式也可以,这串数据复制到浏览器是可以直接访问的资源,在搜索的时候发现在CSS中常用,它的名称是Data URI scheme,目的是将一些小的数据,直接嵌入到网页中,从而不用再从外部文件载入。
base64格式例如以下,复制它到浏览器访问是一张图片:
data:image/png;base64,/9j/4QBqRXhpZgAATU0AKgAAAAgABAEAAAQAAAABAAAAmgEBAAQAAAABAAAAmodpAAQAAAABAAAAPgESAAMAAAABAAEAAAAAAAAAAZIIAAQAAAABAAAAAAAAAAAAAQESAAMAAAABAAEAAAAAAAD/4AAQSkZJRgABAQAAAQABAAD/4gIoSUNDX1BST0ZJTEUAAQEAAAIYAAAAAAIQAABtbnRyUkdCIFhZWiAAAAAAAAAAAAAAAABhY3NwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAA9tYAAQAAAADTLQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAlkZXNjAAAA8AAAAHRyWFlaAAABZAAAABRnWFlaAAABeAAAABRiWFlaAAABjAAAABRyVFJDAAABoAAAAChnVFJDAAABoAAAAChiVFJDAAABoAAAACh3dHB0AAAByAAAABRjcHJ0AAAB3AAAADxtbHVjAAAAAAAAAAEAAAAMZW5VUwAAAFgAAAAcAHMAUgBHAEIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFhZWiAAAAAAAABvogAAOPUAAAOQWFlaIAAAAAAAAGKZAAC3hQAAGNpYWVogAAAAAAAAJKAAAA+EAAC2z3BhcmEAAAAAAAQAAAACZmYAAPKnAAANWQAAE9AAAApbAAAAA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fwtg/UbfofyoFWKbRvd+CNNvlT4nldpD6PjB/JV/Oq5KDJCe5Rj+VXGDifSZOAWsLmQ+9Rw+EIQDksPwkHp5H6VUreO5kj8b3aUxtt4gQ8pI671PNv7X3J6w0kXmQODuOtaHb3bX/ALErpGJLWVwiH5eIpH2YflVC8F2fkjjYsxxyhScn0q28Hl7ngDiy0J/ZxxxTAeuST/kFUiGnBF37nr0Cs3Kk/wCyY/Pp9wK2+xt3MO05HyFefdLH7ZSDg9jW6cOao99pdvMqAs64kOcYYbGhUSy2canLsXPrRvd4/wCH7UclyDggHHWickneasUicDrScsxit5ZMY5UJ6+lHk7UjPvaz53/ZH9KzME9lMvi8dW/iRpLyxSMObqDgbj12x9TXowb7lcGvK3B7snGmkFGKn3qMZBxsSM16jtmLWmSSTvuar9pnwNqefxH5uYM5x8qWDc2cZx51GWzEW6AEjI7VJR/3a/KiKv0aurq6lICcDNF8RQnOx5R13oHP9nJ9Kj5ySqjNFpkBqFnDr2mXVhcqTBOjRkAb7jqPUVgmqezPifTtTNglqJkcM0c6MBGyjz/hPTY/evQlj0PyH86NdAGWMEZHkazWMH032O69faRFeTSR2ssrbQSHdVz1J+4Fano/CFhpOjw6eCzrEuCemSep+pqxy/jPpUPxPJJDwzqUkTtG62zlWU4IPKehqbP9Vz6+M84o1jR9FmkNusM+oR8yRBADyZ25mxUH7PYjJwjxiO5tAPyWQ1TTucmrz7OP/LHF/wD8b/8AElRw9X8jicyKnpxAeI+uK1Tgq4NvdT2LnZgJE9f+4wayix/9P/iFaVpBI4h07G2bdc+vwV0eSNDDF8r0AHWu8D1og/dpesX/2Q==
在typora里插入的方法:
1、例如<img src=''>
,在src里输入这段编码;
2、通过常见的![][src]
,src里是编码,可以看到这里是中括号[],而不是括号。
另外,因为编码比较长,且图片可能较多,所以有的时候我们可以通过把src换成图片编号,然后在文档最后将图片编号指向编码。
示例:
![][1]
![][2]
[1]:base64编码
[2]:base64编码
1、网站很多,比如一个在线的:http://tool.chinaz.com/tools/imgtobase。
2、github上有python脚本,有时离线不方便,而刚好你有python环境的话,可以试试,这个的好处是你可以像平常一样导入本地路径,然后保存之后,使用脚本对这整个md文件进行压缩后base64编码,一键转换:https://github.com/hujingnb/markdownImage/tree/master
本文来自博客园,作者:苏酒酒,转载请注明原文链接:https://www.cnblogs.com/sujiujiu/p/15370010.html