You are here

public function ExternalLinkExtension::allowedHtmlTags in Markdown 8.2

Retrieves the allowed HTML tags.

Parameters

\Drupal\markdown\Plugin\Markdown\ParserInterface $parser: The parser associated with this plugin.

\Drupal\Core\Theme\ActiveTheme $activeTheme: Optional. The active them. This is used as an indicator when in "render mode".

Return value

array An associative array of allowed HTML tags.

Overrides AllowedHtmlInterface::allowedHtmlTags

File

src/Plugin/Markdown/CommonMark/Extension/ExternalLinkExtension.php, line 83

Class

ExternalLinkExtension
Plugin annotation @MarkdownAllowedHtml( id = "commonmark-external-links", ) @MarkdownExtension( id = "commonmark-external-links", label = @Translation("External Links"), description = @Translation("Automatically detect links to external sites…

Namespace

Drupal\markdown\Plugin\Markdown\CommonMark\Extension

Code

public function allowedHtmlTags(ParserInterface $parser, ActiveTheme $activeTheme = NULL) {
  return [
    'a' => [
      'href' => TRUE,
      'hreflang' => TRUE,
      'rel' => [
        'nofollow' => TRUE,
        'noopener' => TRUE,
        'noreferrer' => TRUE,
      ],
      'target' => [
        '_blank' => TRUE,
      ],
    ],
  ];
}