You are here

public function Markdown::getParser in Markdown 3.0.x

Same name in this branch
  1. 3.0.x src/Markdown.php \Drupal\markdown\Markdown::getParser()
  2. 3.0.x src/Plugin/Filter/Markdown.php \Drupal\markdown\Plugin\Filter\Markdown::getParser()
Same name and namespace in other branches
  1. 8.2 src/Markdown.php \Drupal\markdown\Markdown::getParser()

Retrieves a specific MarkdownParser.

Parameters

string $parser: The plugin identifier of the MarkdownParser to retrieve. If not provided, the first enabled Markdown filter in a text formatter available to the current user is used.

string|\Drupal\filter\Plugin\FilterInterface|\Drupal\filter\FilterFormatInterface $filter: Optional A specific filter plugin to use, a string representing a filter format or a FilterFormatInterface object containing a "markdown" filter.

\Drupal\Core\Session\AccountInterface $account: Optional. An account used to retrieve filters available filters if one wasn't already specified.

Return value

\Drupal\markdown\Plugin\Markdown\MarkdownParserInterface A MarkdownParser plugin.

Overrides MarkdownInterface::getParser

File

src/Markdown.php, line 95

Class

Markdown
Class Markdown.

Namespace

Drupal\markdown

Code

public function getParser($parser = NULL, $filter = NULL, AccountInterface $account = NULL) {
  return $this->parsers
    ->createInstance($parser, [
    'filter' => $filter,
    'account' => $account,
  ]);
}