Skip to content

Report undefined footnote references to the broken link callback - #1187

Open
akasakariko wants to merge 1 commit into
pulldown-cmark:mainfrom
akasakariko:fix-broken-footnote-callback
Open

akasakariko wants to merge 1 commit into
pulldown-cmark:mainfrom
akasakariko:fix-broken-footnote-callback

Conversation

@akasakariko

Copy link
Copy Markdown

Fixes #1072

GFM footnote references without a matching definition are rendered as literal text, but they were never reported through the broken link callback. This invokes the callback for those references so callers such as -R and rustdoc can detect them

  • The callback receives the footnote label, the span of [^label], and LinkType::Shortcut
  • Rendering is unchanged and the reference stays literal text
  • The returned URL and title are ignored since footnote references are not links, as now documented on ParserCallbacks::handle_broken_link

Added a regression test covering one undefined and one defined footnote reference

Verification:

  • cargo test --workspace
  • cargo test --features=serde
  • cargo test --features=simd,gen-tests
  • cargo test --no-default-features --features hashbrown
  • cargo check --benches
  • cargo fmt --check
  • printf 'See [^missing]\n' | cargo run -- -R --enable-footnotes now exits non-zero and reports the broken reference

GFM footnote references without a matching definition are rendered as
literal text, but the parser never reported them through the broken link
callback. Invoke the callback for these references and document that the
returned URL and title are ignored since footnote references are not links

This branch has not been deployed

No deployments
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.

Broken footnote links are not included in the broken link callback

1 participant