Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Plugins

Featherlight and Image Caption plugins

Started by Don Robertson 8 years ago · 6 replies · 1701 views
8 years ago

Hi all - I have both the Featherlight and the Image Caption plugins installed and running. Unfortunately the Image caption plugin seems to run after the Featherlight plugin, so figure tag gets surrounded by the a tag that Featherlight adds to run the lightbox effect.

I have tried limiting the scope of the Image Caption plugin to a[rel="lightbox"], but that does not work. And adding the markdown for the image inside a figure tag does not work either.

Is there any way to delay the Featherlight plugin till after the caption plugin has done its work?

8 years ago

I did try renaming the featherlight plugin folder to zz_featherweight, but it didn't show up in the plugins list in admin pages. Realise now I should have cleared the cache. I'll give that a go later on.

8 years ago

In the plugin code itself, there is a "priority" integer that you can set. Higher numbers get executed before lower ones. (See comments in this example code from the docs.)

What seems to be missing is a way to alter plugin priorities outside of the code itself. I'm going to head over to the source code and see if this can be solved relatively easily or not.

8 years ago

I'll draft up an approach and a PR and we'll see what the Grav team thinks of it. It's certainly doable.

8 years ago

Okay - seems I was wrong in my diagnosis. The a tag is not added by the featherlight plugin, but by the core markdown converter. So delaying the loading of the plugin makes no difference - the image is already within the a tag. Promoting the image-caption plugin would not work because there is no image tag for the plugin to find. To fix it - as far as I can see - the Image-caption plugin would need to check if the image tag is surrounded by an a tag, and copy the a tag as well as the image tag into the figure tag.

Should not be too hard (yeah right) and I will have a look later.

The way it is now works - but was showing up as invalid html in a validator. But the w3c validator says it is okay and the spec says it is okay, so I guess it can wait.

Cheers

Don

Suggested topics

Topic Participants Replies Views Activity
Plugins · by Rene, 1 week ago
2 49 1 week ago
Plugins · by Xavier, 4 weeks ago
2 57 4 weeks ago
Plugins · by Luka Prinčič, 7 years ago
3 1184 1 month ago
Plugins · by Sebastian van de Meer, 1 month ago
1 50 1 month ago
Plugins · by PIERROT Alain, 2 months ago
3 75 2 months ago