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:
parent
47b1789430
commit
b9808f23e0
@ -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;
|
||||
|
@ -1,2 +0,0 @@
|
||||
<h2>line</h2>
|
||||
<h2>line</h2>
|
@ -1,5 +0,0 @@
|
||||
line
|
||||
-
|
||||
|
||||
line
|
||||
----
|
5
tests/data/setext_header.html
Normal file
5
tests/data/setext_header.html
Normal file
@ -0,0 +1,5 @@
|
||||
<h1>h1</h1>
|
||||
<h2>h2</h2>
|
||||
<h2>single character</h2>
|
||||
<p>not a header</p>
|
||||
<hr />
|
12
tests/data/setext_header.md
Normal file
12
tests/data/setext_header.md
Normal file
@ -0,0 +1,12 @@
|
||||
h1
|
||||
==
|
||||
|
||||
h2
|
||||
--
|
||||
|
||||
single character
|
||||
-
|
||||
|
||||
not a header
|
||||
|
||||
------------
|
Loading…
Reference in New Issue
Block a user