Kinaconの技術ブログ

Ubuntuはじめました。

Visual Studio code Markdownに画像を貼り付ける

f:id:m-oota-711:20190130202454p:plain

vscodeを使用してMarkdownで資料を作るときの備忘録

目次

画像を挿入する

画像は以下のようにfilepathを指定すれば貼り付けることができる。

![](file_path)

VScodeの拡張機能で画像を貼り付ける

  • Paste Imageをインストールする

 https://marketplace.visualstudio.com/items?itemName=mushan.vscode-paste-image


  • xclipをインストールする

 xclipがないと、入れろと言われます。

sudo apt install xclip


Paste Image の使い方

Paste Imageでは、ctl + alt + v でクリップボードにある画像をpng化して貼り付けてくれる。

png画像の格納先を変更

Paste Imageの画像のデフォルトの格納先は
markdownファイルと同じディレクトリであるが、
markdownファイルと同じディレクトリにimageフォルダを作成して、
そこに画像が格納されるようにsetting.jsonに追記した。



[ .config/Code/User/setting.json ]

{
    "pasteImage.path": "${currentFileDir}/image"
}



以下のようにimageディレクトリが作成され、画像が保存される。

f:id:m-oota-711:20190130113405p:plain

以上。