diff --git a/system/src/Grav/Common/Markdown/ParsedownGravTrait.php b/system/src/Grav/Common/Markdown/ParsedownGravTrait.php index 9b99c05878..bf4955c71a 100644 --- a/system/src/Grav/Common/Markdown/ParsedownGravTrait.php +++ b/system/src/Grav/Common/Markdown/ParsedownGravTrait.php @@ -3,6 +3,7 @@ use Grav\Common\Grav; use Grav\Common\Uri; +use Grav\Common\Utils; use RocketTheme\Toolbox\Event\Event; /** @@ -22,7 +23,6 @@ trait ParsedownGravTrait protected $pages_dir; protected $special_chars; protected $twig_link_regex = '/\!*\[(?:.*)\]\((\{([\{%#])\s*(.*?)\s*(?:\2|\})\})\)/'; - protected $special_protocols = ['xmpp', 'mailto', 'tel', 'sms']; public $completable_blocks = []; public $continuable_blocks = []; @@ -93,7 +93,7 @@ public function addInlineType($type, $tag, $index = null) } else { array_splice($this->InlineTypes[$type], $index, 0, $tag); } - + if (strpos($this->inlineMarkerList, $type) === false) { $this->inlineMarkerList .= $type; } @@ -342,7 +342,7 @@ protected function inlineLink($excerpt) } // if special scheme, just return - if(isset($url['scheme']) && in_array($url['scheme'], $this->special_protocols)) { + if(isset($url['scheme']) && !Utils::startsWith($url['scheme'], 'http')) { return $excerpt; } diff --git a/tests/unit/Grav/Common/Markdown/ParsedownTest.php b/tests/unit/Grav/Common/Markdown/ParsedownTest.php index 2d2b68cdb5..1b22f1c049 100644 --- a/tests/unit/Grav/Common/Markdown/ParsedownTest.php +++ b/tests/unit/Grav/Common/Markdown/ParsedownTest.php @@ -586,6 +586,8 @@ public function testSpecialProtocols() $this->parsedown->text('[tel](tel:123-555-12345)')); $this->assertSame('

sms

', $this->parsedown->text('[sms](sms:123-555-12345)')); + $this->assertSame('

ts.example.com

', + $this->parsedown->text('[ts.example.com](rdp://ts.example.com)')); } public function testSpecialProtocolsSubDir() @@ -600,6 +602,8 @@ public function testSpecialProtocolsSubDir() $this->parsedown->text('[tel](tel:123-555-12345)')); $this->assertSame('

sms

', $this->parsedown->text('[sms](sms:123-555-12345)')); + $this->assertSame('

ts.example.com

', + $this->parsedown->text('[ts.example.com](rdp://ts.example.com)')); } public function testSpecialProtocolsSubDirAbsoluteUrl() @@ -615,6 +619,8 @@ public function testSpecialProtocolsSubDirAbsoluteUrl() $this->parsedown->text('[tel](tel:123-555-12345)')); $this->assertSame('

sms

', $this->parsedown->text('[sms](sms:123-555-12345)')); + $this->assertSame('

ts.example.com

', + $this->parsedown->text('[ts.example.com](rdp://ts.example.com)')); } public function testReferenceLinks()