quarto-dev / quarto-cli

Open-source scientific and technical publishing system built on Pandoc.
https://quarto.org
Other
3.68k stars 297 forks source link

Footnotes in yaml front matter appear multiple times #9700

Open bryanhanson opened 3 months ago

bryanhanson commented 3 months ago

Bug description

I discovered this on my own but then found that someone else had come across it as well. There is a lua filter workaround given at that link, but I wonder if this should be handled automatically.

Steps to reproduce

From the command line, do quarto render test.qmd with the following file:

Here's the example from the link modified slightly:

---
title: "How to add a footnote in the YAML block?"
subtitle: "A Question from Stackoverflow"
author: "Yang Hu ^[Retired]"
format: html
---

A footnote from the body is handled fine.[^1]

[^1]: See what I mean?

Expected behavior

Footnotes from yaml front matter should not appear in triplicate and be numbered correctly.

Actual behavior

Here's the result.

Screenshot 2024-05-16 at 12 01 53 PM

Your environment

Quarto check output

Quarto 99.9.9
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.2.0: OK
      Dart Sass version 1.70.0: OK
      Deno version 1.41.0: OK
      Typst version 0.11.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 99.9.9
fatal: not a git repository (or any of the parent directories): .git
      Path: /Users/bryanh/Documents/Professional/Research/R_Pkgs/quarto-cli/package/dist/bin

Check file:///Users/bryanh/Documents/Professional/Research/R_Pkgs/quarto-cli/src/resources/vendor/deno-land/x/puppeteer@9-0-2/mod.ts
[✓] Checking tools....................OK
      TinyTeX: v2023.07.08
      Chromium: (not installed)

[✓] Checking LaTeX....................OK
      Using: TinyTex
      Path: /Users/bryanh/Library/TinyTeX/bin/universal-darwin
      Version: 2023

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

[✓] Checking Python 3 installation....OK
      Version: 3.12.3
      Path: /opt/homebrew/opt/python@3.12/bin/python3.12
      Jupyter: (None)

      Jupyter is not available in this Python installation.
      Install with python3 -m pip install jupyter

[✓] Checking R installation...........OK
      Version: 4.4.0
      Path: /Library/Frameworks/R.framework/Resources
      LibPaths:
        - /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library
      knitr: 1.46
      rmarkdown: 2.26

[✓] Checking Knitr engine render......OK
mcanouil commented 3 months ago

Thanks for the report.

The following is enought:

---
author: "Yang Hu ^[Retired]"
---

I believe this use of footnot in author has some conflict with the author schema.

cscheid commented 2 months ago

This will be hard to solve. The issue here is that some content causes "side effects" in the document. Footnotes, for example, cause "a new footnote to appear". We copy the contents of the author field (and probably authors), and as a result, we end up with multiple instances of ^[Retired].

The problem, of course, is that there's no way for us to know, in general, what parts of the metadata have "side effects", so we can't know what to remove in what context.