Footnotes for Kirby

footnotes
markdown
plugin

#1

Footnotes for Kirby CMS

This plugin extends Kirby with some basic and extremely easy footnote functionalities. The syntax is simple to understand and if the plugin is removed the remaining text still makes sense (docs are referring to versions 1.0.0+)

Usage

Use the footnotes method on the field: $page->text()->footnotes() or $page->text()->ft(). Adding footnotes to your Kirbytext field is simple. Just type them inline in your post in square brackets like this:

[^This is a footnote.]

For example:

“In a deterritorialized context, the conventional one-to-one 
relationship between state and territory is increasingly 
questioned and challenged” [^Wong, L. (2002): Home away from 
home? Abingdon: Routledge. Seite 171]

In-text reference mark:


Bibliography at the end of the text:*

Docs & Download: https://github.com/distantnative/footnotes
See it in use: http://servicethinker.de/blog/interaktionsdesign-der-zukunft

Support me: with buying a moral license


#2

v0.7 released:

  • Added options to limit footnotes to specific templates (whitelist & blacklist)
  • Added option to merge identical footnotes

#3

I really love this plugin and I’m using it heavily! Great job!

By the way: the right link for the moral license is this one: https://gumroad.com/l/kirby-footnotes


#4

Always loving academic support - this seems pretty close to the existing integration of footnotes in Markdown Extra which Kirby supports out-of-the-box though – are there any added pros on using the plugin?


#5

I think there are quite a few advantages, apart from the easier markup it also provides a method and a lot more features, but checkout the readme on GitHub: https://github.com/distantnative/footnotes


#6

To be fair: I came up with this before being aware of the Markdown Extra footnotes. And it started mainly as a transfer of a wordpress plugin. But looking at it now, I still prefer this markup as it keeps the information right at the point where they belong in plain text and still convert them to footnotes through the plugin.

Plus methods to remove footnotes altogether (e.g. in a excerpt), to whitelist and blacklist footnotes depending on templates and (just recently added) to merge identical footnotes automatically.

If you have further ideas/suggestions, let me now!


#7

I rather have MultiMarkdown style footnotes; at least that’s the semi-official standard for footnotes in Markdown. So why reinventing the wheel?


#8

For the stated reasons. Of course, everyone should use what they prefer and what matches their taste best. I like it this way and thought it’d be nice to share the code instead keeping it too myself. Feel free to use or not use it :wink:


#9

You’re right. Thanks for sharing. :slight_smile:


#10

The new Multimarkdown (as of release 4.3.1)syntax offers a pretty similar inline approach (docs on inline footnotes); I’m not sure if Parsedown already supports this, though – stumbled on this by accident in the Marked2 doc and thought, I’d put it up here for reference.


#11

Thanks for sharing. I’ll see if Parsedown is supporting this in any way.
If not at all, I might consider changing the plugin to feature a similar syntax:

[^footnote]

and maybe for reference-less ones:

[^!footnote]

#12

Hi, thank you very much for this plugin!

I’m unsure where to add the parameter in order to make the footnotes disappear from my blog overview:

echo $post->text()->footnotes(false)->kirbytext();

Which file has to be updated?

Also, is there a way to include the numbers within the footnotes themselves? I’d like to have a numbered list. Another suggestion would be a headline for the footnotes.

Really appreciate your help!


#13

That one would go into your blogoverview template - while in your single blog post template, you’d use

echo $post->text()->footnotes()->kirbytext();

The footnotes at the bottom are in a ol-List with the CSS selector .footnotes ol - so you could just define that in your css (http://www.w3schools.com/cssref/pr_list-style-type.asp):

.footnotes ol {
 list-style-type: decimal;
}

#14

1.0.0 released:

  • Requires Kirby 2.3.0
  • Switched to follow the markdown footnotes mark-up
  • Identical footnotes are now always merged
  • Updated package.json to work with the Kirby CLI
  • Completely refactored PHP (including namespacing)
  • Renamed config options for consistency
  • Switched to MIT License

#15

Is there a way to print the footnotes on a different div outside of the one I am using to print the body-text?
I mean, is there a way to only output the footnotes portion of a text field?

And, how do I de-activate the kirby-native footnotes if I am using your plugin? At the moment, they are being merged with the footnotes plugin, but the <ol> list is being printed.

Thanks!


#16

From the plugin docs

Separate bibliography output

If you do not want the bibliography to be appened right after the field text, you first have to deactivate thhe bibliography in the field method:

<?= $page->text()->footnotes(['bibliography' => false]) ?>

And then output the bibliography where wanted:

<?= dnFootnotes::bibliography($page->text()) ?>

#17

I have a problem with the spacing of the footnotes list:
I might have messed up my css and cannot find it out why but, how can I control those spaces (margin/padding) between each ol li?

The only quick solution I found is to set a negative margin, but I would prefer not to do that.

(added borders around each ol li for easier visualisation)


#18

Using your browser’s developer tools (Right click > Inspect element, in most browsers) should help you see what HTML elements are there and what styles are applied to them (and from where).

If your markup is just <li>Some text</li><li>Next item</li>, then it’s most likely margins applied on the li elements, or perhaps margins applied to those specific li elements.

If your markup looks like <li><p>Some text</p></li><li><p>Next item</p></li> (another common pattern), then it might be margins applied to the p elements too.


#19

I think the “See it in use” link isn’t up-to-date anymore.


#20

For some reasons the plugin outputs <br> tags between each footnote’s <li> element and—as reported here already—I can’t find any <br> in the code.

I just tested this on a kirby starterkit website, both by using

<?= $page->text()->kirbytext()->footnotes() ?>

and

<?= $page->text()->footnotes() ?>

Anyone would be able to help figure this out?

Thanks!
af