Markdown Reference Links Stop Working with Markdown Extra and Nested Markdown

I have Markdown Extra enabled, but when I try to nest markdown in block elements, reference links stop working.

For example, if you take Kirby Starterkit and the following to the config file:

c::set('markdown.extra', true);

and then make the Home.txt file resemble:

Title: Home

----

Intro: Yay! If you are seeing this, the installation of Kirby worked. :-)

----

Text: 

[foo]: https://www.example.com/

This is an [example][foo]. Another [example](https://www.example.com/).

## Get started

<div markdown="1">
- Go to the (link: panel text: Panel) to give Kirby's admin interface a try
- Check out the (link: http://getkirby.com/docs text: docs) and start building your own site
- Follow (twitter: @getkirby) on Twitter for updates
- Visit the (link: http://forum.getkirby.com text: forum) to connect with other Kirby users
- Sign up to (link: https://getkirby.com/#kosmos text: Kirby Kosmos), our monthly newsletter
- (link: http://getkirby.com/support text: Get in contact) if you need support.
</div>

**Have fun with Kirby!**

then you’ll have an output that looks like:


If you were to change markdown="1" to markdown="0" then the reference link will work again, but (obviously) the Markdown list within the <div> element will not work.

Is this a bug, or am I missing some subtle error on my part?

Interestingly, it works if you put the reference at the end.

I suspect this is an issue related to ParsedownExtra, the MarkdownExtra parser used by Kirby.

Yep, you’re totally right. I tested on http://parsedown.org/extra/ and can confirm.

I filed an issue there: https://github.com/erusev/parsedown-extra/issues/114

Thanks for the workaround!