Skip to content

fix: no endnotes section for unreferenced footnotes#236

Merged
dereuromark merged 1 commit into
masterfrom
fix/unreferenced-footnote-endnotes
Jun 9, 2026
Merged

fix: no endnotes section for unreferenced footnotes#236
dereuromark merged 1 commit into
masterfrom
fix/unreferenced-footnote-endnotes

Conversation

@dereuromark

Copy link
Copy Markdown
Contributor

What

The endnotes section was emitted whenever any footnote definition was collected (collectedFootnotes), regardless of whether it was referenced. A footnote defined but never referenced produced a stray, empty section:

Before, text\n\n[^f]: note:

<p>text</p>
<section role="doc-endnotes">
<hr>
<ol>
</ol>
</section>

Fix

Gate the section on referenced footnotes only (footnoteNumbers, populated when a reference is rendered). An unreferenced definition now produces no output. Referenced footnotes are unchanged.

Backport of the footnote part of markup-carve/carve-php#31 (shared parser lineage).

Tests

Added a case asserting an unreferenced footnote definition emits no doc-endnotes section. Full suite and official corpus green.

The endnotes section was emitted whenever any footnote definition was
collected, even if none were referenced. A footnote defined but never
referenced produced a stray empty section with an empty ordered list.

Gate the section on referenced footnotes (footnoteNumbers) only, so an
unreferenced definition produces no output.
@codecov

codecov Bot commented Jun 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.89%. Comparing base (32c0d50) to head (f434bf1).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##             master     #236   +/-   ##
=========================================
  Coverage     91.89%   91.89%           
+ Complexity     3523     3522    -1     
=========================================
  Files           106      106           
  Lines          9958     9958           
=========================================
  Hits           9151     9151           
  Misses          807      807           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dereuromark dereuromark merged commit 0a34a1d into master Jun 9, 2026
6 checks passed
@dereuromark dereuromark deleted the fix/unreferenced-footnote-endnotes branch June 9, 2026 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant