Download the PHP package sylvainjule/footnotes without Composer
On this page you can find all versions of the php package sylvainjule/footnotes. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download sylvainjule/footnotes
More information about sylvainjule/footnotes
Files in sylvainjule/footnotes
Package footnotes
Short Description Footnotes plugin for Kirby 3 and 4
License MIT
Informations about the package footnotes
Kirby Footnotes
This plugin extends Kirby 3 and 4 with some basic, extremely easy and unopinionated footnote functionalities.
Overview
This plugin is completely free and published under the MIT license. However, if you are using it in a commercial project and want to help me keep up with maintenance, please consider making a donation of your choice.
- 1. Installation
- 2. Basic usage
- 3. Advanced usage
- 3.1. Collect notes from multiple fields
- 3.2. Usage with blocks
- 4. Frontend customization
- 5. Options
- 6. Methods
- 7. License
- 8. Credits
1. Installation
Download and copy this repository to
Alternatively, you can install it with composer:
2. Basic usage
Use the footnotes method on your field: $page->text()->footnotes()
or $page->text()->ft()
(no need to call ->kirbytext()
before or after, this method will take care of it).
Adding footnotes to your Kirbytext field is simple. Just type them inline in your post in square brackets like this:
Each footnote must start with a caret (^
) and will be numbered automatically. Footnotes can contain anything you want including links or images, but please note that you should not include unescaped square brackets [] inside a footnote.
If you add square brackets in a note (This is a truncated […] quote
for example), you must escape the closing bracket belonging to the note:
For example, with the default setup this text:
This is a footnote.[^Right here!] Here is a test with a footnote that contains a link.[^ Yes, there is indeed (link: https://getkirby.com text: a link.)] And, well, just to be sure things are working I'm throwing a third footnote in here.[^ All good!]
Will output:
3. Advanced usage
3.1. Collect notes from multiple fields
If you have multiple fields on your page you'd like to collect footnotes from, an output a signle container at the end of your page, instead of using the footnotes()
method, you can use the collectFootnotes()
one.
This method will return the text with footnotes references, no footnotes container, and store the footnotes container for later use.
For example:
3.2. Usage with blocks
The plugins provides a collectFootnotes()
blocks method, intended to collect all footnotes found in the converted blocks (you need to chain it after the toBlocks()
method).
4. Frontend customization
As you can see with the raw output above, the plugin is completely unopinionated. It doesn't ship with any CSS or JS code but provides the markup to adjust its styling to suit your website.
Here is a reference of the outputted markup and classes to grab for styling:
In your stylesheet:
5. Options
There are a few options:
5.1. Wrapper
For semantic purposes, you can manually set which HTML tag to use as footnotes container, aside
, footer
, etc. (default is a simple div
)
5.2. Back
The string displayed at the end of a footnote, linking to its reference within the text. Default is ↩
/ ↩.
If you don't want any return link to appear, set this value to false
.
5.3. Links
If you don't want the footnote references and footnotes to be links, for example if you are displaying them as sidenotes instead of footnotes, set this to false
. Default is true
.
If set to false
, the footnote's back link won't be appended to the footnote, and the syntax of the footnote reference within the text changes :
6. Methods
7. License
MIT
8. Credits
This plugin has been built on top of the K2 version by @distantnative. 🙏