Download the PHP package philippoehrlein/inline-footnotes without Composer
On this page you can find all versions of the php package philippoehrlein/inline-footnotes. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download philippoehrlein/inline-footnotes
More information about philippoehrlein/inline-footnotes
Files in philippoehrlein/inline-footnotes
Package inline-footnotes
Short Description A CommonMark extension to support inline footnotes in the format [^Text of the footnote]
License MIT
Homepage https://github.com/philippoehrlein/inline-footnotes
Informations about the package inline-footnotes
Inline Footnotes for CommonMark
This PHP library extends the League/CommonMark parser to support inline footnotes in the format [^Footnote text]
. Unlike the reference-style footnote format commonly used in various Markdown implementations, this format allows you to enter the footnote text directly at the point where it's needed.
How It Works
This extension doesn't handle the rendering of footnotes itself. Instead, it works as a preprocessor that:
- Detects inline footnotes in the format
[^Footnote text]
- Converts them to standard reference-style footnotes before passing the content to the CommonMark parser
- Relies on the standard
FootnoteExtension
for actual rendering
Therefore, you need to use both extensions together.
Installation
Install the library via Composer:
Usage
Format
The inline footnotes can be used anywhere in the text and are converted to regular Markdown footnotes:
[^This is an inline footnote]
is converted to a numbered footnote during preprocessing.- The footnotes can also contain complex content such as links and formatting.
- The extension also supports nested brackets within footnotes.
Difference from Reference-Style Footnotes
The footnote syntax with numbered references (as implemented in MultiMarkdown, GitHub Flavored Markdown, and other Markdown flavors) requires a separate definition at the end of the document:
With this extension, the footnote text can be specified directly inline:
Related Markdown Dialects
MultiMarkdown, created by Fletcher Penney, supports both footnote styles: the reference-style footnotes ([^id]) and inline footnotes ([^This is an inline footnote.]). Many Markdown editors including iA Writer have adopted this syntax.
Unlike MultiMarkdown, this extension focuses specifically on providing inline footnote capability to the League/CommonMark parser. If you need reference-style footnotes, the standard League/CommonMark footnote extension already supports them.
License
This project is licensed under the MIT License.