Markdown (Extra) Footnotes don’t render as HTML but text



I’m using Kirby’s Markdown Extra config-setting and want to use the Footnotes feature in blog articles:


<?php echo $page->text()->kirbytext() ?>


foo bar baz [^note1].

[^note1]: footnote foo.

And while I get valid HTML for the footnotes list itself, the content of the footnote list items is not rendered as HTML but as plain text so I get this as output (not as HTML source):

 1. <p>footnote foo.&#160;<a href="#fnref1:note1" rev="footnote" class="footnote-backref">&#8617;</a></p> 

I’m using Kirby 2.5.12 (confirmed for 2.5.10+ as well). Any ideas? Thanks for any hint.



You could decode the html entities with a regex in a custom kirbytext post filter.

// filters which are called AFTER markdown and tags are parsed
kirbytext::$post[] = function($kirbytext, $value) {
  return preg_replace_callback('/(&lt;p&gt;.*rev="footnote".*&gt;&lt;\/p&gt)/s', function($match) {
    return html_entity_decode($match[0]);
  }, $value);

Or have a look at this plugin.
Haven’t tested the plugin though.



The question is: why would I need to do this. The markdown library itself that is used supports footnotes completely correct and standalone this works fine.
So I wonder what Kirby does that it doesn’t work anymore in the Kirby context.

And to be honest I don’t want to use another plugin for a functionality that should work already.


1 Like


Seems to be a problem with the used version of the parsedown package.
I just updated the packages (parsedown, parsedown-extra) and it seems to work fine with the currently available versions.

Just found that there is already an issue:


Footnotes with markdown:extra activated in additional textarea
Footnotes with markdown:extra activated in additional textarea

Right, that seems to be the exact issue then. Thanks for your help and research, I’ll see if I can help fixing it and wait for the release. Cheers!