Skip to content

Disallow whitespace in footnote identifiers#431

Merged
lepture merged 1 commit intolepture:mainfrom
bysiber:fix-footnote-spaces
Feb 22, 2026
Merged

Disallow whitespace in footnote identifiers#431
lepture merged 1 commit intolepture:mainfrom
bysiber:fix-footnote-spaces

Conversation

@bysiber
Copy link
Copy Markdown
Contributor

@bysiber bysiber commented Feb 21, 2026

Fixes #377.

The footnote patterns (REF_FOOTNOTE and INLINE_FOOTNOTE) used LINK_LABEL which permits spaces. According to the PHP Markdown Extra spec, footnote identifiers must not contain whitespace.

Introduced a _FOOTNOTE_LABEL pattern that adds \s to the exclusion set, preventing [^foot note] from being parsed as a footnote reference while keeping [^footnote] working as expected.

The footnote regex used LINK_LABEL which permits spaces, tabs, and
newlines. According to the PHP Markdown Extra spec, footnote
identifiers must not contain whitespace. Introduce _FOOTNOTE_LABEL
that excludes \s characters while keeping the same escaping rules.

Fixes lepture#377
@sonarqubecloud
Copy link
Copy Markdown

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.69%. Comparing base (df23edd) to head (87c091f).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #431   +/-   ##
=======================================
  Coverage   91.69%   91.69%           
=======================================
  Files          34       34           
  Lines        2637     2637           
  Branches      430      430           
=======================================
  Hits         2418     2418           
  Misses        147      147           
  Partials       72       72           
Flag Coverage Δ
unittests 91.65% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 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.

@lepture lepture merged commit 78e82aa into lepture:main Feb 22, 2026
24 checks passed
@lepture
Copy link
Copy Markdown
Owner

lepture commented Feb 22, 2026

Thanks

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.

footnotes accept spaces in identifiers

2 participants