You are here

public function StrikethroughExtension::register in Markdown 8.2

Allows the extension to register itself with the CommonMark Environment.

Parameters

\League\CommonMark\Environment\ConfigurableEnvironmentInterface|\League\CommonMark\ConfigurableEnvironmentInterface|\League\CommonMark\Environment $environment: The CommonMark environment. The exact object passed here has changed namespaces over various versions. It is unlikely to be incompatible, however, explicit typechecking via instanceof may be needed.

Overrides BaseExtension::register

File

src/Plugin/Markdown/CommonMark/Extension/StrikethroughExtension.php, line 77

Class

StrikethroughExtension
Strikethrough extension.

Namespace

Drupal\markdown\Plugin\Markdown\CommonMark\Extension

Code

public function register($environment) {

  // Support manual uafrica/commonmark-ext implementation.
  if (class_exists('\\CommonMarkExt\\Strikethrough\\StrikethroughParser')) {
    $environment
      ->addInlineParser(new \CommonMarkExt\Strikethrough\StrikethroughParser());
    if (class_exists('\\CommonMarkExt\\Strikethrough\\StrikethroughRenderer')) {
      $environment
        ->addInlineRenderer(new \CommonMarkExt\Strikethrough\StrikethroughRenderer());
    }
    return;
  }
  parent::register($environment);
}