use League\CommonMark\Inline\Element\AbstractInline;
use League\CommonMark\Inline\Element\Link;
use League\CommonMark\Inline\Renderer\InlineRendererInterface;
-use League\CommonMark\Util\ConfigurationInterface;
-use League\CommonMark\Util\RegexHelper;
class Renderer implements InlineRendererInterface
{
- /**
- * @var ConfigurationInterface
- */
- protected $config;
/**
* @param Link $inline
$attrs = $inline->getData('attributes', []);
- $forbidUnsafeLinks = !$this->config->get('allow_unsafe_links');
- if (!($forbidUnsafeLinks && RegexHelper::isLinkPotentiallyUnsafe($inline->getUrl()))) {
- $href = $inline->getUrl();
- if (stristr($href, 'internal:')) {
- $href = Menu::internalToHref($href);
- }
- $attrs['href'] = $href;
+
+ $href = $inline->getUrl();
+ if (stristr($href, 'internal:')) {
+ $href = Menu::internalToHref($href);
}
+ $attrs['href'] = $href;
if (isset($inline->data['title'])) {
$attrs['title'] = $inline->data['title'];
return new HtmlElement('a', $attrs, $htmlRenderer->renderInlines($inline->children()));
}
- /**
- * @param ConfigurationInterface $configuration
- */
- public function setConfiguration(ConfigurationInterface $configuration)
- {
- $this->config = $configuration;
- }
}