sublimetext3markdowninsert-image

How do I insert an image path quickly in markdown using sublime text


I am writing some markdown file which will show some images in another directory. The directory structure is like the following:

D:\NUTSHARE\PERSONAL_NOTE
├─daily_note
├─images
├─misc
├─resources
└─tech_note

I write markdown file in one of the daily_note, misc, resources and tech_note directory and reference images in the images directory.

To insert image, I use the Markdown syntax: ![<IMG_DESCRITPION>](<IMG_PATH>). I wonder if there are tools or shortcut or snippet to help me to quickly insert the path of an image located in the images directory. Having to type the relative path every time I want to insert an image is time-wasting.


Solution

  • After some searching and trial and error. I have found a way to insert an image's relative path easily into Markdown file.

    Prerequisite

    We need to install two handy sublime text plugins: MarkdownEditting and SideBarEnhancements.

    Insert an image path quickly

    MarkdownEditting provide a snippet to type inline image quickly. Type mdi and press TAB will insert a inline image template.

    Then go to the sidebar and find the image, right click on the image you want to insert and choose Copy as Text -> Relative Path from View. Then paste the relative path of the image onto the inline image template created before.