Skip to content

Conversation

@3b
Copy link
Owner

@3b 3b commented Nov 20, 2025

inline references like [^foo], with definitions as blocks starting with [^foo]:.

questions for users::

  • bugs/missing features?
  • what should be configurable and/or have different defaults?
    • css classes?
    • formatting of links?
    • container element for list of footnotes?
    • separator before/after definitions?
  • is ^[inline footnote] version common/useful enough to be worth implementing? (or some other syntax)

todo:

  • text/md output
  • documentation
  • configuration
  • tests
  • improve formatting of output?
  • option for adding some extra text to footnote IDs to allow displaying multiple markdown documents on one page (for example comments, or making an html file out of the test suite)

3b added 2 commits November 20, 2025 03:46
inline references like `[^foo]`, with definitions as blocks
starting with `[^foo]:`.
Copy link

@scymtym scymtym left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mentioned a few simplifications using composition of esrap rule actions.

Comment on lines 27 to 32
(defrule footnote-block (and (! 3bmd-grammar::blank-line)
3bmd-grammar::line
(* footnote-block-line))
(:destructure (b l block)
(declare (ignore b))
(text l block)))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rule action can be written as

(:function rest)
(:destructure (l block)
  (text l block))

Comment on lines 45 to 47
(:destructure (i1 i2 line)
(declare (ignore i1 i2))
line))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just (:function third).

Comment on lines 19 to 23
(define-extension-inline *footnotes* footnote-ref
(and footnote (! #\:))
(:destructure (id x)
(declare (ignore x))
(list 'footnote-ref id)))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For rule actions, esrap can compose multiple transformations. In cases like this, it is convenient to "pre-process" with a :function action:

(:function first)
(:lambda (id)
  (list 'footnote-ref id))

Comment on lines 15 to 17
(:destructure (o id c)
(declare (ignore o c))
(text id)))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See next comment for general explanation.

(:function second)
(:text t)

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.

3 participants