sphinx-contrib / images

sphinxcontrib-images extension
Apache License 2.0
17 stars 14 forks source link

Figure directives #15

Open thedrow opened 4 years ago

thedrow commented 4 years ago

Can we add support for figure directives as well as image directives?

jonascj commented 4 years ago

Could you elaborate a little?

There is the numfig configuration option which adds numbers to all "figures", tables etc. if they have a caption.

There is also the figure directive.

Do you just wish the lightbox2 css applied to images inserted/loaded through the figure: whatever.jpg directive?

thedrow commented 4 years ago

Do you just wish the lightbox2 css applied to images inserted/loaded through the figure: whatever.jpg directive?

Yes.

jonascj commented 4 years ago

Great idea, I could easily have wished for that myself in the past. Feel free to implement it and make a PR, otherwise I'll have a look at it a few weeks from now.

jonascj commented 3 years ago

How time flies when you have a baby and a 3-year-old! Please accept my apologies for not attending to the PRs and issues in a timely fashion. I'll attend to them at the latest on August 29th and 30th (I have another project with deadline on August 28th).

icq8680 commented 3 years ago

@jonascj I think the main concern of adding lightbox to figures is that lightbox label does not have a translatable text, i.e. if you add a caption to your LB image, you won't be able to translate the phrase

SilverRainZ commented 3 years ago

Any news?

jonascj commented 3 years ago

@SilverRainZ No, I haven't looked into it yet. You are welcome to submit a PR if you can find a way to implement it. See also #20 :-)

jonascj commented 2 years ago

Some findings and/or realizations which might be worth remembering, going forward with this:

At present .. thumbnail:: can not be referenced in any way (afaik). Adding an explicit target above a thumbnail directive will result in a warning, i.e. this will not work with thumbnails (but it works with .. image::):

.. _target whatever:

.. thumbnail:: whatever.jpg

An image of whatever can be seen here: :ref:`Whatever <target whatever>`.
thedrow commented 2 years ago

I don't see why thumbnails shouldn't have a unique id. It can be a random id if it is just for this purpose.

jonascj commented 2 years ago

27 Indicates there is currently no way of referencing .. thumbnail:: directives, explicit targets do not work (see above or #27). That is a bug imo and we should at least fix that.

At the same time I think we should make the .. thumbnail:: directive behave like .. figure::, if numfig = True thumbnails should be numbered just as figures (maybe with a sphinxcontrib.images configuration option to turn on/off this feature). I suppose it could be done two ways: 1) Utilize the figure directive when producing thumbnails, 2) create/register a counter with the .. thumbnail:: directive.