Closed Lohoris closed 5 years ago
Which version are you using? I can't reproduce your issue.
Test script:
<?php
require_once __DIR__ . '/vendor/autoload.php';
$parsedown = new Parsedown;
$text = <<<EOF
# This is OK
This is OK
- This is OK
# This is NOT ok
Still NOT ok
- OK again now
Still broken here, though.
EOF;
$html = $parsedown->text($text);
echo 'Parsedown v' . $parsedown::version;
echo '<hr>';
echo $html;
echo '<hr>';
echo '<pre><code>' . htmlspecialchars($html) . '</code></pre>';
Just for visibility within the thread, the output in the latest release (Parsedown 1.7.1) is:
<h1>This is OK</h1>
<p>This is OK</p>
<ul>
<li>This is OK</li>
</ul>
<h1>This is NOT ok</h1>
<p>Still NOT ok</p>
<ul>
<li>OK again now</li>
</ul>
<p>Still broken here, though.</p>
which seems to be fine...
@Lohoris would it be possible to post which version of Parsedown you are using?
Please reopen if you can provide more info.
The only thing I can suggest is that perhaps you are passing the input through nl2br
before giving the input to Parsedown? If so the given result is actually for the input:
# This is OK<br />
This is OK<br />
- This is OK<br />
# This is NOT ok<br />
Still NOT ok<br />
- OK again now<br />
Still broken here, though.
and this would indeed give the result you have posted. If so, this would be essentially a duplicate of #649 (since block precedence v.s. continuation line is involved).
Sorry for not being able to investigate earlier.
You nailed it, it was exactly that!
<ul>
is never closed, causing any subsequent text to be incorrectly indented, until another<ul>
comes by.Example: