mirror of
https://github.com/erusev/parsedown.git
synced 2023-08-10 21:13:06 +03:00
leading spaces should not get trimmed
This commit is contained in:
parent
ee9a1e92c0
commit
8e6f4cf7b8
@ -210,10 +210,15 @@ class Parsedown
|
||||
goto paragraph;
|
||||
}
|
||||
|
||||
# Code
|
||||
# Code Block
|
||||
|
||||
if ($line[0] === ' ' and preg_match('/^[ ]{4}(.*)/', $line, $matches))
|
||||
{
|
||||
if (trim($line) === '')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($element['type'] === 'code')
|
||||
{
|
||||
if (isset($element['interrupted']))
|
||||
@ -279,6 +284,11 @@ class Parsedown
|
||||
|
||||
$pure_line = $line[0] !== ' ' ? $line : ltrim($line);
|
||||
|
||||
if ($pure_line === '')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
# Link Reference
|
||||
|
||||
if ($pure_line[0] === '[' and preg_match('/^\[(.+?)\]:[ ]*([^ ]+)/', $pure_line, $matches))
|
||||
|
1
tests/data/whitespace.html
Normal file
1
tests/data/whitespace.html
Normal file
@ -0,0 +1 @@
|
||||
<pre><code>This text starts with a line that consists of 4 spaces and it ends with one. This is a code block to make sure that leading spaces don't get trimmed.</code></pre>
|
5
tests/data/whitespace.md
Normal file
5
tests/data/whitespace.md
Normal file
@ -0,0 +1,5 @@
|
||||
|
||||
|
||||
This text starts with a line that consists of 4 spaces and it ends with one. This is a code block to make sure that leading spaces don't get trimmed.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user