diff options
Diffstat (limited to 'vendor/league/html-to-markdown/src/Converter')
-rw-r--r-- | vendor/league/html-to-markdown/src/Converter/LinkConverter.php | 19 | ||||
-rw-r--r-- | vendor/league/html-to-markdown/src/Converter/TextConverter.php | 2 |
2 files changed, 18 insertions, 3 deletions
diff --git a/vendor/league/html-to-markdown/src/Converter/LinkConverter.php b/vendor/league/html-to-markdown/src/Converter/LinkConverter.php index 81c18b65f..ed52619d2 100644 --- a/vendor/league/html-to-markdown/src/Converter/LinkConverter.php +++ b/vendor/league/html-to-markdown/src/Converter/LinkConverter.php @@ -2,11 +2,25 @@ namespace League\HTMLToMarkdown\Converter; +use League\HTMLToMarkdown\Configuration; +use League\HTMLToMarkdown\ConfigurationAwareInterface; use League\HTMLToMarkdown\ElementInterface; -class LinkConverter implements ConverterInterface +class LinkConverter implements ConverterInterface, ConfigurationAwareInterface { /** + * @var Configuration + */ + protected $config; + + /** + * @param Configuration $config + */ + public function setConfig(Configuration $config) { + $this->config = $config; + } + + /** * @param ElementInterface $element * * @return string @@ -52,7 +66,8 @@ class LinkConverter implements ConverterInterface */ private function isValidAutolink($href) { - return preg_match('/^[A-Za-z][A-Za-z0-9.+-]{1,31}:[^<>\x00-\x20]*/i', $href) === 1; + $useAutolinks = $this->config->getOption('use_autolinks'); + return $useAutolinks && (preg_match('/^[A-Za-z][A-Za-z0-9.+-]{1,31}:[^<>\x00-\x20]*/i', $href) === 1); } /** diff --git a/vendor/league/html-to-markdown/src/Converter/TextConverter.php b/vendor/league/html-to-markdown/src/Converter/TextConverter.php index fcd466094..6236a1e9d 100644 --- a/vendor/league/html-to-markdown/src/Converter/TextConverter.php +++ b/vendor/league/html-to-markdown/src/Converter/TextConverter.php @@ -35,7 +35,7 @@ class TextConverter implements ConverterInterface } } - return $markdown; + return htmlspecialchars($markdown, ENT_NOQUOTES, 'UTF-8'); } /** |