Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blade escapes html generated from markdown extra footnotes #44

Closed
carbontwelve opened this issue Jun 24, 2019 · 5 comments
Closed

Blade escapes html generated from markdown extra footnotes #44

carbontwelve opened this issue Jun 24, 2019 · 5 comments
Labels
bug Something isn't working

Comments

@carbontwelve
Copy link

When using footnotes from the extended markdown functionality I notice that footnote html is escaped e.g:

<div class="footnotes">
   <hr />
   <ol>
   <li id="fn:1">
   &lt;p&gt;At the time of this article being written this was freely available from &lt;a href="http://edn.embarcadero.com/article/20841#2HowtoDownloadTurboC"&gt;here&lt;/a&gt;. However it appears that they have put the download behind a sign-up wall - which while admittedly is free means I have mirrored a copy &lt;a href="/files/tc201.zip"&gt;here on Photogabble&lt;/a&gt; for ease of access and for future prosperity if ever the original source goes away for good.&amp;#160;&lt;a href="#fnref1:1" rev="footnote" class="footnote-backref"&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
   </li>
 </ol>

Oddly enough none of the other html produced by markdown seems to have been escaped.

@bakerkretzmar
Copy link
Contributor

We switched markdown parsers in v1.3.16, can you confirm if this is still an issue after updating?

@bakerkretzmar bakerkretzmar added the needs more info Needs more information. label Apr 17, 2020
@carbontwelve
Copy link
Author

Hi @bakerkretzmar I have kept this tab open since April, and will get around to checking and answering your question. This whole pandemic has made my workload blow up and finding spare time to work on my personal projects has been difficult.

@bakerkretzmar
Copy link
Contributor

No rush at all, stay safe!

@elazar
Copy link

elazar commented Jan 23, 2021

It appears this was a known issue in the Markdown parser used in v1.3.15 and prior versions, namely erusev/parsedown-extra#158.

Here's a test using the Markdown parser used in v1.3.16 and beyond, which appears to have the correct behavior.

require __DIR__ . '/vendor/autoload.php';

use Michelf\MarkdownExtra;

$my_text = <<<EOS
Here's a simple footnote,[^1] and here's a longer one.[^bignote]

[^1]: This is the first footnote.

[^bignote]: Here's one with multiple paragraphs and code.

    Indent paragraphs to include them in the footnote.

    `{ my code }`

    Add as many paragraphs as you like.
EOS;

$my_html = MarkdownExtra::defaultTransform($my_text);

echo $my_html, PHP_EOL;

Resulting HTML:

<p>Here's a simple footnote,<sup id="fnref:1"><a href="#fn:1" class="footnote-ref" role="doc-noteref">1</a></sup> and here's a longer one.<sup id="fnref:bignote"><a href="#fn:bignote" class="footnote-ref" role="doc-noteref">2</a></sup></p>

<div class="footnotes" role="doc-endnotes">
<hr />
<ol>

<li id="fn:1" role="doc-endnote">
<p>This is the first footnote.&#160;<a href="#fnref:1" class="footnote-backref" role="doc-backlink">&#8617;&#xFE0E;</a></p>
</li>

<li id="fn:bignote" role="doc-endnote">
<p>Here's one with multiple paragraphs and code.</p>

<p>Indent paragraphs to include them in the footnote.</p>

<p><code>{ my code }</code></p>

<p>Add as many paragraphs as you like.&#160;<a href="#fnref:bignote" class="footnote-backref" role="doc-backlink">&#8617;&#xFE0E;</a></p>
</li>

</ol>
</div>

I think this issue can be safely closed.

@bakerkretzmar
Copy link
Contributor

Sounds good, @elazar thanks a lot for taking the time to check that out!

@bakerkretzmar bakerkretzmar added bug Something isn't working and removed needs more info Needs more information. labels Jan 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants