Skip to content

Add footnotes.#228

Open
jbeder wants to merge 1 commit intoswiftlang:mainfrom
jbeder:main
Open

Add footnotes.#228
jbeder wants to merge 1 commit intoswiftlang:mainfrom
jbeder:main

Conversation

@jbeder
Copy link
Copy Markdown

@jbeder jbeder commented May 8, 2025

This relies on the footnote extension in cmark, which does not expose footnote type names, but does expose enough information via the type enum.

Bug/issue #, if applicable:

Summary

Adds new footnote types FootnoteDefinition and FootnoteReference to the markdown tree.

Dependencies

None. It would be nice to use swiftlang/swift-cmark#57, but it's not necessary; there's a small hack that can reliably detect when cmake produces footnotes.

This is heavily based on #129, which also adds footnote support; however, that PR does rely on the upstream swift-cmark PR, whereas this one does not.

Testing

New test introduced to verify the parsing of footnotes, which pass with ./bin/test.

Checklist

Make sure you check off the following items. If they cannot be completed, provide a reason.

  • Added tests
  • Ran the ./bin/test script and it succeeded
  • Updated documentation if necessary

This relies on the footnote extension in cmark, which does not expose footnote type names, but does expose enough information via the type enum.
Jud added a commit to Jud/swift-markdown that referenced this pull request Apr 1, 2026
Adds FootnoteDefinition (block) and FootnoteReference (inline) node
types, enabling parsing of [^label] references and [^label]: definitions.

Based on swiftlang/swift-markdown PR swiftlang#228 by jbeder, with fixes:
- Removed accidentally committed empty files
- Fixed copy-paste doc comment errors on FootnoteReference.footnoteID
- Fixed visitor @param names and grammar

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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