Skip to content

Citations not resolved when used without brackets inside non-inline footnotes followed by punctuation #11596

@marviro

Description

@marviro

Description

When using citations in Markdown with Pandoc, references written without brackets (i.e. @key instead of [@key]) are not resolved when they appear inside non-inline footnotes and are immediately followed by punctuation (e.g. a period).

This results in missing citation output in the generated document, even though similar syntax works correctly in other contexts.

Steps to Reproduce

Markdown input (myfile.md):

---
bibliography: bib.bib
title: Test
---

@myref

[^1]

[^1]: @myref.

BibTeX file (bib.bib):

@book{myref,
  address = {test},
  series = {test},
  title = {Title},
  publisher = {test},
  author = {Author},
  year = {1997},
}

Command:

pandoc -s myfile.md -o myfile.html

Expected Behavior

The citation inside the footnote (@myref.) should be properly parsed and rendered as a citation, just like in the main text or when using bracketed citations.

Actual Behavior

The citation inside the footnote is not resolved. The output HTML contains an empty list element in the footnote:

<li id="fn1">
  <ol class="example" type="1">
    <li></li>
  </ol>
  <a href="#fnref1" class="footnote-back" role="doc-backlink">↩︎</a>
</li>

Additional Observations

  • The issue occurs only when punctuation immediately follows the citation key inside the footnote.
  • If the period is removed, the citation is correctly parsed.

Modified footnote:

[^1]: @myref

Result (correct output):

<p><span class="citation" data-cites="myref">@myref</span></p>
...
<li id="fn1">
  <p><span class="citation" data-cites="myref">@myref</span>
  <a href="#fnref1" class="footnote-back" role="doc-backlink">↩︎</a></p>
</li>
  • Using bracketed citations (e.g. [@myref].) works as expected.
  • The same @key. syntax outside of footnotes is handled correctly.

Possible Cause

This suggests that the citation parser fails to correctly tokenize bare citations (@key) followed by punctuation when they occur in block-level footnote definitions.

Environment

  • Pandoc version: 3.9.1 (also affects earlier versions)
  • Output format: HTML
  • Input format: Markdown with bibliography

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions