在csdn中写markdown笔记导入自己的md笔记,如何解决图片不显示的问题?
作者:卡卷网发布时间:2024-12-02 18:53浏览数量:101次评论数量:0次
这个其实主要是要用图床,你本地写的时候就用图床地址,然后导入csdn只要这个地址csdn能访问到,会自动转存的。多种不同方法:
vscode + markdown image插件
免费的图床比较常用的可以用github,结合vscode的传图插件比如 Markdown Image
AutoHotKey快捷键工具
自己准备图床,然后通过快捷键工具AutoHotKey脚本实现快捷键自动粘贴上传
比如这里我用的ahk脚本
#Include Gdip_All.ahk
hexoPath := "C:/qiucao/Blog"
PicPath := hexoPath . "/blog_images/"
imageFormat := "png"
filenameFormat := "yyyyMMdd_HHmmss"
httpPath := "https://图床地址.../"
isPushWhenSave := false
^F1::
; 保存图片的位置和格式
FormatTime, currentFilenameFormat, A_Now, %filenameFormat%
savePath := PicPath . currentFilenameFormat . "." . imageFormat
saveHttpPath := httpPath . currentFilenameFormat . "." . imageFormat
createPic(savePath)
clipboard := ""
send, ^v
if isPushWhenSave
send, ^{F2}
return
^F2::
run,cmd /c cd /D %hexoPath% & git add . & git commit -m "update images" & git push origin gh-pages
return
F8::
ExitApp
return
createPic(PicPath)
{
pToken := Gdip_Startup() ; Start gdi+
; pBitmapAlpha := Gdip_CreateBitmapFromFile(PicPath)
;pBitmapAlpha := Gdip_BitmapFromScreen(0, "")
;pBitmapAlpha := Gdip_BitmapFromScreen(x "|" y "|" width "|" height)
pBitmapAlpha := Gdip_CreateBitmapFromClipboard()
ImgWidth := Gdip_GetImageWidth(pBitmapAlpha) ; 获取宽度,高度,可省略
ImgHeight := Gdip_GetImageHeight(pBitmapAlpha)
Gdip_SaveBitmapToFile(pBitmapAlpha, PicPath,"255") ;第三个参数控制图片质量
Gdip_DisposeImage(pBitmapAlpha)
Gdip_Shutdown(pToken) ; close gdi+
}
发布到其他平台后通过富文本编辑器拷贝过来
CSDN目前不支持直接导入word或pdf文档,但支持直接粘贴富文本
所以另一个变通的方法,是把本地包含图片的md文档,用pandoc之类的转换工具转为其他格式,发布到支持文档直接导入的平台上,再把富文本内容直接拷贝过来
免责声明:本文由卡卷网编辑并发布,但不代表本站的观点和立场,只提供分享给大家。
相关推荐

你 发表评论:
欢迎