alangrainger / obsidian-image-captions

Add captions to images with inline Markdown and link support. The caption format is compatible with the CommonMark spec and other Markdown applications.
GNU General Public License v3.0
98 stars 7 forks source link

Use name of the file as caption-text #11

Closed berot3 closed 1 year ago

berot3 commented 1 year ago

Hi!

Is there a easy way to copy/paste or insert a variable as text? 80% of the time I already wrote as file-name what I want to have as caption.

I thought about something like ![[Big tree.jpg|$]] so $ would be a place-holder/variable for the file-name. it picks up the file-name and I dont have to copy paste it :)

Of course you would have to implement it in you plugin that if $ is the caption than it uses the file-name.

OR - What would be also a intersting way to solve this: add an option to the plugin that if the caption is empty than it will use file-name. if a caption/text is present than not.

What do you think? :)

alangrainger commented 1 year ago

Great suggestion! This is added in v1.0.8:

https://github.com/alangrainger/obsidian-image-captions/releases/tag/1.0.8

I have used % as the placeholder character. If you want a literal % as your caption, you can escape it: \%.

cedrikl commented 1 year ago

Is there a way to also show the file extension in its current implementation? (for example "%%") This is already proving game changer for my workflow as is so thank you much for this plugin.

alangrainger commented 1 year ago

For my own education, what's the use-case of wanting to show the file extension along with the title?

alangrainger commented 1 year ago

@cedrikl from v1.0.9 you can use %.% to get filename including extension.

cedrikl commented 1 year ago

Thanks Alan! With put the picture name as a caption in our documents because when we export, it moves all those raw pictures to a separate folder. The captions allows the next team to quickly find the original associated to the picture in the document. The file extension is more of a safety in case we have a scenario with PICTURE.jpg and PICTURE.png. It should ensure no two pictures can have the same caption.