Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lighbox does not show placeholder image from the shortcode #10713

Open
cderv opened this issue Sep 4, 2024 · 0 comments
Open

Lighbox does not show placeholder image from the shortcode #10713

cderv opened this issue Sep 4, 2024 · 0 comments
Labels
enhancement New feature or request lightbox shortcodes issues related to shortcodes upstream Bug is in upstream library
Milestone

Comments

@cderv
Copy link
Collaborator

cderv commented Sep 4, 2024

---
title: "Lightbox test"
format: html
lightbox: true
---

![Content]({{< placeholder >}})

The image won't be shown in the modal when clicking.

I think this is a bad interaction because placeholder create data-uri image, this is not correctly handled by Lightbox in the way we configure it.

placeholder shortcode will create this

<img src="data:image/png;base64,<<encoded>>" class="img-fluid figure-img" alt="Content">

Our filter do take everything to set on the link of class lightbox and especially take the src to become the href

-- wrap decorated images in a link with appropriate attrs
local link = pandoc.Link({imgEl}, imgEl.src, title, linkAttributes)

This does not play well with Lighbox which uses the href to select the type. And href being a data uri is not ok. So it default to external type in lightbox https://github.com/biati-digital/glightbox/blob/b71340f54371169276d01f84adcfa443a917a621/src/js/core/slide-parser.js#L34-L67

which leads to using an iframe and not an image, when creating the lighbox modal. This prevent the image to show.

I believe we should correctly make this placeholder interact with lightbox. We may need to patch glightbox for that or just wait for upstream to add the feature

(this is not a problem with embed-resources because images are encoded later in the process and the Lua filter already put href on the link using the src being a filename with extension. Then Lightbox do the right think to find back the encoded part).

@cderv cderv added enhancement New feature or request upstream Bug is in upstream library lightbox labels Sep 4, 2024
@cderv cderv added this to the Future milestone Sep 4, 2024
@mcanouil mcanouil added the shortcodes issues related to shortcodes label Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request lightbox shortcodes issues related to shortcodes upstream Bug is in upstream library
Projects
None yet
Development

No branches or pull requests

2 participants