1
0
mirror of https://github.com/erusev/parsedown.git synced 2025-09-04 20:25:27 +02:00

Compare commits

...

4 Commits
0.4.3 ... 0.4.5

Author SHA1 Message Date
Emanuil Rusev
4403fe4d96 labels of reference links should be case insensitive 2013-11-08 21:59:26 +02:00
Emanuil Rusev
400c8f7d46 simplify regex for inline link in attempt to resolve #23 2013-11-08 00:24:40 +02:00
Emanuil Rusev
379cbf34b3 parse_block_elements doesn't have to use ltrim on lines with no indentation 2013-11-07 22:48:15 +02:00
Emanuil Rusev
b6c8cac512 optimize quick paragraph 2013-11-07 22:46:01 +02:00
3 changed files with 9 additions and 4 deletions

View File

@@ -205,7 +205,7 @@ class Parsedown
# Quick Paragraph
if ($line[0] >= 'A' and $line[0] !== '_' and $line[0] !== '[')
if ($line[0] >= 'a' or $line[0] >= 'A' and $line[0] <= 'Z')
{
goto paragraph; # trust me
}
@@ -277,13 +277,13 @@ class Parsedown
# ~
$pure_line = ltrim($line);
$pure_line = $line[0] !== ' ' ? $line : ltrim($line);
# Link Reference
if ($pure_line[0] === '[' and preg_match('/^\[(.+?)\]:[ ]*([^ ]+)/', $pure_line, $matches))
{
$label = $matches[1];
$label = strtolower($matches[1]);
$url = trim($matches[2], '<>');
$this->reference_map[$label] = $url;
@@ -560,7 +560,7 @@ class Parsedown
# Inline Link / Image
if (strpos($text, '](') !== FALSE and preg_match_all('/(!?)(\[((?:[^][]+|(?2))*)\])\((.*?)\)/', $text, $matches, PREG_SET_ORDER)) # inline
if (strpos($text, '](') !== FALSE and preg_match_all('/(!?)(\[((?:[^\[\]]|(?2))*)\])\((.*?)\)/', $text, $matches, PREG_SET_ORDER)) # inline
{
foreach ($matches as $matches)
{

View File

@@ -2,6 +2,7 @@
<p>Here's <a href="http://parsedown.org">one</a> on the next line.</p>
<p>Here's <a href="http://parsedown.org/tests/">one</a> with a different URL.</p>
<p>Here's <a href="http://parsedown.org">one</a> with a semantic name.</p>
<p>Here's <a href="http://parsedown.org">one</a> with an upper case label definition.</p>
<p>Here's <a href="http://parsedown.org">one</a> with definition name on the next line.</p>
<p>Here's [one][404] with no definition.</p>
<p>Here's an image: <img alt="Markdown Logo" src="/md.png"></p>

View File

@@ -13,6 +13,10 @@ Here's [one][website] with a semantic name.
[website]: http://parsedown.org
Here's [one][case] with an upper case label definition.
[CASE]: http://parsedown.org
Here's [one]
[website] with definition name on the next line.