telesoho / vscode-markdown-paste-image

Smartly paste for Markdown.
MIT License
135 stars 41 forks source link

Image overriding #12

Open Klepeto opened 6 years ago

Klepeto commented 6 years ago

I understand why is it so, but... It can easily happen that I override existing image unintentionally - so my markdown file will be broken on some place... And it does not notify me about overriding ):

(btw - great extension, thanks for it...)

telesoho commented 6 years ago

@Klepeto Tank you for your advice #11 and #12.

The extension user the current time as image file name. I think it is a best practice using the recommend file name as part of image file name, ex. youwantfilename_2017_01_01_12_11_10_123.png

By doing so, you can avoid image overwrite, because the recommend file name always different from before one. If you really want to overwrite the before one, you have to modify the file name same as the before one image, or you can select the file name in markdown then press Ctrl+Alt+V.

I think the simplest is the best, if user have more choices, may be confuse them. Also may be user will not use this feature in 80% time.

RobinWillson commented 4 years ago

May I ask how to set rule to make filename "youwantfilename_2017_01_01_12_11_10_123.png"?

altho1 commented 3 years ago

You can grab this functionality from mushanshitiancai/vscode-paste-image Ref: pasteImage.defaultName

The default image file name.

The value of this config will be pass to the 'format' function of moment library(a js time manipulation library), you can read document https://momentjs.com/docs/#/displaying/format/ for advanced usage.

And you can use variable:

${currentFileName}: the current file name with ext. ${currentFileNameWithoutExt}: the current file name without ext. Default value is Y-MM-DD-HH-mm-ss.