mirror of
https://github.com/erusev/parsedown.git
synced 2024-09-20 03:51:29 +02:00
added option not to parse links
This commit is contained in:
parent
ebfdace4c6
commit
99ae736aa5
@ -48,6 +48,18 @@ class Parsedown
|
|||||||
|
|
||||||
private $breaks_enabled = false;
|
private $breaks_enabled = false;
|
||||||
|
|
||||||
|
|
||||||
|
# Switch links parsing.
|
||||||
|
|
||||||
|
function set_parse_links($flag)
|
||||||
|
{
|
||||||
|
$this->parse_links = $flag;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
private $parse_links = true;
|
||||||
|
|
||||||
#
|
#
|
||||||
# Synopsis
|
# Synopsis
|
||||||
#
|
#
|
||||||
@ -969,7 +981,7 @@ class Parsedown
|
|||||||
|
|
||||||
if (strpos($text, '>') !== false)
|
if (strpos($text, '>') !== false)
|
||||||
{
|
{
|
||||||
if ($text[1] === 'h' and preg_match('/^<(https?:[\/]{2}[^\s]+?)>/i', $text, $matches))
|
if ($this->parse_links and $text[1] === 'h' and preg_match('/^<(https?:[\/]{2}[^\s]+?)>/i', $text, $matches))
|
||||||
{
|
{
|
||||||
$element_url = $matches[1];
|
$element_url = $matches[1];
|
||||||
$element_url = str_replace('&', '&', $element_url);
|
$element_url = str_replace('&', '&', $element_url);
|
||||||
@ -1046,7 +1058,7 @@ class Parsedown
|
|||||||
|
|
||||||
case 'http':
|
case 'http':
|
||||||
|
|
||||||
if (preg_match('/^https?:[\/]{2}[^\s]+\b/ui', $text, $matches))
|
if ($this->parse_links and preg_match('/^https?:[\/]{2}[^\s]+\b/ui', $text, $matches))
|
||||||
{
|
{
|
||||||
$element_url = $matches[0];
|
$element_url = $matches[0];
|
||||||
$element_url = str_replace('&', '&', $element_url);
|
$element_url = str_replace('&', '&', $element_url);
|
||||||
|
Loading…
Reference in New Issue
Block a user