You are here

public function MissingParser::parse in Markdown 8.2

Parses markdown into HTML.

Parameters

string $markdown: The markdown string to parse.

\Drupal\Core\Language\LanguageInterface $language: Optional. The language of the markdown to be parsed.

Return value

\Drupal\markdown\Render\ParsedMarkdownInterface A safe ParsedMarkdown object.

Overrides ParserInterface::parse

See also

\Drupal\markdown\Render\ParsedMarkdownInterface

File

src/Plugin/Markdown/MissingParser.php, line 101

Class

MissingParser
The parser used as a fallback when the requested one doesn't exist.

Namespace

Drupal\markdown\Plugin\Markdown

Code

public function parse($markdown, LanguageInterface $language = NULL) {
  $html = (string) FilterHtml::fromParser($this)
    ->process($markdown, $language ? $language
    ->getId() : NULL);
  return ParsedMarkdown::create($markdown, $html, $language);
}