erusev / parsedown-extra

Markdown Extra Extension for Parsedown

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Reference Links Don't Work When `markdown="1"` is Used Anywhere

neildaniels opened this issue · comments

If a reference link is not defined at the very end of a document and a markdown="1" is used anywhere, then the reference links do not work.

For example:

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

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

<div markdown="1">
- This is a list item
</div>

Generates the following erroneous HTML:

<p>This is an [example][foo]. Another <a href="https://www.example.com/">example</a>.</p>
<div>
<ul>
<li>This is a list item</li>
</ul>
</div>

As you can see, [example][foo] shows up as a literal text, instead of the text "example" linked to what "foo" refers to.

For comparison, PHP Markdown Extra correctly generates:

<p>This is an <a href="https://www.example.com/">example</a>. Another <a href="https://www.example.com/">example</a>.</p>

<div>

<ul>
<li>This is a list item</li>
</ul>

</div>

Workaround

As pointed out on the Kirby Forums, if the reference links are defined at the end of the document, everything works fine. However, this still seems worth fixing.