Skip to content

feat: support footnote macro conversion to Markdown footnotes - #40

Open
mxmehl wants to merge 2 commits into
opendevise:mainfrom
mxmehl:add-footnote-support
Open

feat: support footnote macro conversion to Markdown footnotes#40
mxmehl wants to merge 2 commits into
opendevise:mainfrom
mxmehl:add-footnote-support

Conversation

@mxmehl

@mxmehl mxmehl commented Jul 3, 2026

Copy link
Copy Markdown

Fixes #35

This PR add the feature to convert AsciiDoc footnote:[text] macros to Markdown footnote syntax. Inline references become [^N] with consecutively assigned numbers. Footnote definitions are appended at the end of the document as [^N]: text lines.

Named footnotes (footnote:id[text]) are also supported, and back-references (footnote:id[]) reuse the same number as the first definition. Footnote text goes through full normal substitutions, including URL macros with bracketed labels. Escaped macros (\footnote:) pass through verbatim.

Also supports footnotes provided as part of attributes.

mxmehl added 2 commits July 3, 2026 13:18
Footnote extraction ran as a pre-processing step before the
substitution chain, so a footnote hidden inside an attribute
reference (e.g. {link-antrag}) was never seen: the reference had
not been expanded yet, and by the time the macros substitution ran
it only knew how to expand the numeric footnote token.

Surface attribute references before footnote extraction so that
footnotes arriving via an attribute are tokenized in document
order, matching AsciiDoc's macros-after-attributes ordering. Also
reuse a named footnote whenever its id is already defined (text
ignored on reuse, per spec), which lets a named footnote shared
through an attribute reference resolve to a single definition.

Assisted-by: Claude:claude-sonnet-4.6
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.

Syntax support request: Footnote macro

1 participant