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

Formatting in figure captions are ignored in lightbox images #11727

Open
apcamargo opened this issue Dec 22, 2024 · 4 comments
Open

Formatting in figure captions are ignored in lightbox images #11727

apcamargo opened this issue Dec 22, 2024 · 4 comments
Assignees
Labels
bug Something isn't working lightbox regression Functionality that used to work but now is broken.
Milestone

Comments

@apcamargo
Copy link

apcamargo commented Dec 22, 2024

Bug description

Text formatting (bold, italics, etc.) is not rendered in the lightbox image caption, even though the text shows up as expected in the main document.

Image Image

Steps to reproduce

---
title: Test
authors:
  - name: Norah Jones
    affiliation: The University
    roles: writing
    corresponding: true
project:
  type: manuscript
manuscript:
  article: index.qmd
---

{{< lipsum 1 >}}

![Morbi *euismod* justo sit amet mi **molestie bibendum**. Integer quis varius lectus.]({{< placeholder 600 500 >}}){#fig-placeholder}

{{< lipsum 1 >}}

Expected behavior

No response

Actual behavior

No response

Your environment

No response

Quarto check output

Quarto 1.6.39
[✓] Checking environment information...
      Quarto cache location: /Users/APCamargo-M55/Library/Caches/quarto
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.4.0: OK
      Dart Sass version 1.70.0: OK
      Deno version 1.46.3: OK
      Typst version 0.11.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.6.39
      Path: /Applications/quarto/bin

[✓] Checking tools....................OK
      TinyTeX: (not installed)
      Chromium: (not installed)

[✓] Checking LaTeX....................OK
      Tex:  (not detected)

[✓] Checking basic markdown render....OK

[✓] Checking Python 3 installation....OK
      Version: 3.9.20 (Conda)
      Path: /Users/apcamargo/.micromamba/bin/python
      Jupyter: (None)

      Jupyter is not available in this Python installation.
      Install with conda install jupyter

[✓] Checking R installation...........(None)

      Unable to locate an installed version of R.
      Install R from https://cloud.r-project.org/
@apcamargo apcamargo added the bug Something isn't working label Dec 22, 2024
@mcanouil
Copy link
Collaborator

Thanks for the report, unfortunately your example is not reproducible and does not even have lightbox activated.
Please check your code.


You can share a self-contained "working" (reproducible) Quarto document using the following syntax, i.e., using more backticks than you have in your document (usually four ````).
See https://quarto.org/bug-reports.html#small-is-beautiful-aim-for-a-single-document-with-10-lines.

If you have multiple files (and if it is absolutely required to have multiple files), please share as a Git repository.

RPython
````qmd
---
title: "Reproducible Quarto Document"
format: html
engine: knitr
---

This is a reproducible Quarto document.

{{< lipsum 1 >}}

```{r}
x <- c(1, 2, 3, 4, 5)
y <- c(1, 4, 9, 16, 25)

plot(x, y)
```

![An image]({{< placeholder 600 400 >}}){#fig-placeholder}

{{< lipsum 1 >}}

The end after @fig-placeholder.
````
````qmd
---
title: "Reproducible Quarto Document"
format: html
engine: jupyter
---

This is a reproducible Quarto document.

{{< lipsum 1 >}}

```{python}
import matplotlib.pyplot as plt

x = [1, 2, 3, 4, 5]
y = [1, 4, 9, 16, 25]

plt.plot(x, y)
plt.show()
```

![An image]({{< placeholder 600 400 >}}){#fig-placeholder}

{{< lipsum 1 >}}

The end after @fig-placeholder.
````

Additionally and if not already given, please share the output of quarto check within a code blocks (i.e., using three backticks ```txt), see https://quarto.org/bug-reports.html#check.

@mcanouil mcanouil added the needs-repro Issues that are blocked until reporter provides an adequate reproduction label Dec 23, 2024
@apcamargo
Copy link
Author

Just updated the code with a reproducible one. Lightbox isn't enabled because this is a manuscript project.

@mcanouil
Copy link
Collaborator

Your updated example is invalid and not reproducible.
project and manuscript are only valid in _quarto.yml.
Did you try your code?

Here is a small simple reproducible example:

---
title: "Quarto Playground"
format: html
lightbox: true
---

![An image caption in **bold** or *italic*.]({{< placeholder 600 400 >}}){#fig-placeholder}

This is a regression from v1.4 (#7592, a4a2049).

I bisected the issue to 0b77bc9

@mcanouil mcanouil added regression Functionality that used to work but now is broken. and removed needs-repro Issues that are blocked until reporter provides an adequate reproduction labels Dec 23, 2024
@mcanouil mcanouil added this to the v1.7 milestone Dec 23, 2024
@cderv cderv self-assigned this Dec 23, 2024
@cderv
Copy link
Collaborator

cderv commented Dec 23, 2024

This is happening because the caption of the image is used as the Title and not a description div; Title is used as attributes and we get this

title="Figure&nbsp;1: An image caption in bold or italic."

This is created with pandoc.utils.stringify() which loose any AST information

title = pandoc.utils.stringify(title)

This is also because Lightbox title get its own style.

If we want to improve this, we probably need to revisit #7592. In 1.4, no title was set and the caption content was set as Description, which can easily use some html.

The question will be what to do when some description is passed

---
title: "Quarto Playground"
format: html
lightbox: true
---

![An image caption in **bold** or *italic*.]({{< placeholder 600 400 >}}){#fig-placeholder description="Some description"}

#7592 make sure it is used - and why the caption was used as Title.
Image

We won't be able to maintain both. 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working lightbox regression Functionality that used to work but now is broken.
Projects
None yet
Development

No branches or pull requests

3 participants