mirror of
https://github.com/erusev/parsedown.git
synced 2023-08-10 21:13:06 +03:00
Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
4403fe4d96 | |||
400c8f7d46 | |||
379cbf34b3 | |||
b6c8cac512 |
@ -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)
|
||||
{
|
||||
|
@ -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>
|
||||
|
@ -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.
|
||||
|
||||
|
Reference in New Issue
Block a user