erusev / parsedown

Better Markdown Parser in PHP
https://parsedown.org
MIT License
14.68k stars 1.12k forks source link

Parsedown not counting linebreaks properly? Images also wrapped in <p> tags. #830

Open scottynorris opened 2 years ago

scottynorris commented 2 years ago

My current usage:

$markdown = file_get_contents($filepath); 
new Parsedown(); ?>

echo Parsedown::instance()
   ->setBreaksEnabled(true) # enables automatic line breaks
   ->text($markdown);

My file:

Blah blah blah
Blah.
![alt text](https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png "Logo Title Text 1")

This outputs:

<p>Blah blah blah</p>
<p>Blah.</p>
<p><img src="https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png" alt="alt text" title="Logo Title Text 1" /></p>

How comes it's not counting the line breaks and why is it added p tags to the image?

Many thanks!