alangrainger/obsidian-image-captions

Captions do not support percentage widths

Closed this issue · 5 comments

I had a transclusion that was like this:

![[filename.png|100%]] which actually works to make it 100% width (nice for mobile, and other typesetting cases

I wanted to add a caption using this plugin, and tried:

![[filename.png|caption text|100%]] but it doesn't work with the %. The caption turned up as "caption text|100%" and the width was ignored. This is syntax that is generally supported in Obsidian, and I suggest that this plugin should support it as well.

Thanks!

As far as I'm aware Obsidian doesn't support percentage scaling, which is why the plugin also does not support it.

If I test in the Sandbox vault, adding a percentage scale does nothing. You're very welcome to submit a pull request to add this functionality, but as it currently stands the plugin uses the existing Obsidian scaling.

It does support it, compare:

image

Where I gave the image a 500px width, and it is clipped when I make the window small, vs:

image

Where it scales to the available size in the small window.

These were taken with the caption plugin disabled.

With the plugin enabled, it becomes:

image

The caption, which is out of view, just says "A Cat"

and

image

Where you can see that the image scales properly, but the Caption includes the "|100%" characters, as if they should be part of the caption.

Make sense?

My original report was wrong, in that I said that it did not support it - it seems that it does, but the caption text is wrong. Sorry for the error and confusion.

I'm a bit confused by the report, sorry!

If you are saying that percentage scales are supported, can you please take a screenshot of the Sandbox Vault with no plugins, showing that percentages are supported by Obsidian by default?

Please don't use 100%, as that is the default for all images, thus shows nothing. Please use something else like 20%.

I apologize. I had been using 100%, and it didn't occur to me that it might be the default. So nevermind - it seems my issue is moot.