直接從剪貼板粘貼圖像到markdown/asciidoc(或其他文件)!
支持Mac和Windows / Linux ! 並支持配置目標文件夾。
paste-image
現在您可以啟用pasteImage。 showFilePathConfirmInputBox修改保存前的文件路徑:
confirm-inputbox
用法:
1、捕捉屏幕到剪貼板
2、打開命令面板:Ctrl+Shift+P (Cmd+Shift+P在Mac上)
3、輸入:“粘貼圖像”或你可以使用默認的鍵盤綁定:Ctrl+Alt+V (Cmd+Alt+V在Mac上)。
4、圖像將保存在包含當前編輯文件的文件夾中
5、相對路徑將被粘貼到當前編輯文件中
例子:
我使用vscode編輯我的hexo博客。 文件夾結構如下:
blog/source/_posts (articles)
blog/source/img (images)
我想保存在博客/源/img的所有圖像,並插入圖像url到文章。 而hexo將生成blog/source/作為網站的根目錄,所以圖像的url應該是/img/xxx.png。 所以我可以在blog/。vscode/setting中配置pasteImage。 json是這樣的:
"pasteImage.path": "${projectRoot}/source/img", "pasteImage.basePath": "${projectRoot}/source", "pasteImage.forceUnixStyleSeparator": true, "pasteImage.prefix": "/"
如果你想保存圖像在單獨的目錄:
"pasteImage.path": "${projectRoot}/source/img/${currentFileNameWithoutExt}", "pasteImage.basePath": "${projectRoot}/source", "pasteImage.forceUnixStyleSeparator": true, "pasteImage.prefix": "/"
如果你想保存圖像與文章名稱為前綴:
"pasteImage.namePrefix": "${currentFileNameWithoutExt}_", "pasteImage.path": "${projectRoot}/source/img", "pasteImage.basePath": "${projectRoot}/source", "pasteImage.forceUnixStyleSeparator": true, "pasteImage.prefix": "/"
如果你想在markdown中使用html:
"pasteImage.insertPattern": "<img>${imageFileName}</img>" "pasteImage.path": "${projectRoot}/source/img", "pasteImage.basePath": "${projectRoot}/source", "pasteImage.forceUnixStyleSeparator": true, "pasteImage.prefix": "/"