1
0
mirror of https://github.com/erusev/parsedown.git synced 2023-08-10 21:13:06 +03:00

setext underlines should not work on interrupted paragraphs

This commit is contained in:
Emanuil 2013-09-24 22:36:24 +03:00
parent 47b1789430
commit b9808f23e0
5 changed files with 19 additions and 9 deletions

View File

@ -205,7 +205,7 @@ class Parsedown
# Setext Header (---)
if ($element['type'] === 'p' and preg_match('/^[-]+[ ]*$/', $line))
if ($element['type'] === 'p' and ! isset($element['interrupted']) and preg_match('/^[-]+[ ]*$/', $line))
{
$element['type'] = 'h.';
$element['level'] = 2;
@ -315,7 +315,7 @@ class Parsedown
# Setext Header (===)
if ($element['type'] === 'p' and preg_match('/^[=]+[ ]*$/', $line))
if ($element['type'] === 'p' and ! isset($element['interrupted']) and preg_match('/^[=]+[ ]*$/', $line))
{
$element['type'] = 'h.';
$element['level'] = 1;

View File

@ -1,2 +0,0 @@
<h2>line</h2>
<h2>line</h2>

View File

@ -1,5 +0,0 @@
line
-
line
----

View File

@ -0,0 +1,5 @@
<h1>h1</h1>
<h2>h2</h2>
<h2>single character</h2>
<p>not a header</p>
<hr />

View File

@ -0,0 +1,12 @@
h1
==
h2
--
single character
-
not a header
------------