atom-markdown-image-assistant
atom-markdown-image-assistant copied to clipboard
Prepend current date
I'd like to add a date to the filename of the image,
E.g. instead of readme-a85f5b36.png
I would like to have readme-2019-04-15-a85f5b36.png
.
I have some progress on that, but I need some advice, since I never used Coffeescript before.
-
I added a new entry to config
prependCurrentdate: title: "Prepend current date" description: "Whether to prepend current date in format yyyy-mm-dd" type: 'boolean' default: true
It is displayed in settings, so I assume that it works.
-
I add the following lines (simplified)
if atom.config.get('markdown-image-assistant.prependCurrentDate') today = 'yay' else today = 'whoops' img_filename = today + img_filename
The problem is that I always get 'whoops' prepended, no matter if the "prependCurrentdate" is ticked in the settings or not. If I get this fixed, I can make a pull request.
Maybe try initializing today
prior to the if-else? Can you verify that atom.config.get('markdown-image-assistant.prependCurrentDate')
is returning the right value?
Indeed, this variable was undefined, because of 1 lower-case letter instead of upper-case.