class Markdown in Markdown 3.0.x
Same name in this branch
- 3.0.x src/Markdown.php \Drupal\markdown\Markdown
- 3.0.x src/Plugin/Filter/Markdown.php \Drupal\markdown\Plugin\Filter\Markdown
Same name and namespace in other branches
- 8.2 src/Markdown.php \Drupal\markdown\Markdown
Class Markdown.
Hierarchy
- class \Drupal\markdown\Markdown implements MarkdownInterface uses \Symfony\Component\DependencyInjection\ContainerAwareTrait, DependencySerializationTrait, StringTranslationTrait
Expanded class hierarchy of Markdown
1 file declares its use of Markdown
- markdown.module in ./
markdown.module - Markdown module.
3 string references to 'Markdown'
1 service uses Markdown
File
- src/
Markdown.php, line 15
Namespace
Drupal\markdownView source
class Markdown implements MarkdownInterface {
use ContainerAwareTrait;
use DependencySerializationTrait;
use StringTranslationTrait;
/**
* The MarkdownParser Plugin Manager.
*
* @var \Drupal\markdown\MarkdownParserManagerInterface
*/
protected $parsers;
/**
* Markdown constructor.
*
* @param \Drupal\markdown\MarkdownParserManagerInterface $markdown_parsers
* The MarkdownParser Plugin Manager service.
*/
public function __construct(MarkdownParserManagerInterface $markdown_parsers) {
$this->parsers = $markdown_parsers;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container = NULL) {
if (!isset($container)) {
$container = \Drupal::getContainer();
}
return new static($container
->get('plugin.manager.markdown.parser'));
}
/**
* {@inheritdoc}
*/
public static function load($id, $markdown = NULL, $parser = NULL, $filter = NULL, AccountInterface $account = NULL, LanguageInterface $language = NULL) {
return static::create()
->getParser($parser, $filter, $account)
->load($id, $markdown, $language);
}
/**
* {@inheritdoc}
*/
public static function loadPath($id, $path, $parser = NULL, $filter = NULL, AccountInterface $account = NULL, LanguageInterface $language = NULL) {
return static::create()
->getParser($parser, $filter, $account)
->loadPath($id, $path, $language);
}
/**
* {@inheritdoc}
*/
public static function loadUrl($id, $url, $parser = NULL, $filter = NULL, AccountInterface $account = NULL, LanguageInterface $language = NULL) {
return static::create()
->getParser($parser, $filter, $account)
->loadUrl($id, $url, $language);
}
/**
* {@inheritdoc}
*/
public static function parse($markdown, $parser = NULL, $filter = NULL, AccountInterface $account = NULL, LanguageInterface $language = NULL) {
return static::create()
->getParser($parser, $filter, $account)
->parse($markdown, $language);
}
/**
* {@inheritdoc}
*/
public static function parsePath($path, $parser = NULL, $filter = NULL, AccountInterface $account = NULL, LanguageInterface $language = NULL) {
return static::create()
->getParser($parser, $filter, $account)
->parsePath($path, $language);
}
/**
* {@inheritdoc}
*/
public static function parseUrl($url, $parser = NULL, $filter = NULL, AccountInterface $account = NULL, LanguageInterface $language = NULL) {
return static::create()
->getParser($parser, $filter, $account)
->parseUrl($url, $language);
}
/**
* {@inheritdoc}
*/
public function getParser($parser = NULL, $filter = NULL, AccountInterface $account = NULL) {
return $this->parsers
->createInstance($parser, [
'filter' => $filter,
'account' => $account,
]);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DependencySerializationTrait:: |
protected | property | ||
DependencySerializationTrait:: |
protected | property | ||
DependencySerializationTrait:: |
public | function | 2 | |
DependencySerializationTrait:: |
public | function | 2 | |
Markdown:: |
protected | property | The MarkdownParser Plugin Manager. | |
Markdown:: |
public static | function |
Instantiates a new instance of this class. Overrides ContainerInjectionInterface:: |
|
Markdown:: |
public | function |
Retrieves a specific MarkdownParser. Overrides MarkdownInterface:: |
|
Markdown:: |
public static | function |
Loads a cached ParsedMarkdown object. Overrides MarkdownInterface:: |
|
Markdown:: |
public static | function |
Loads a cached ParsedMarkdown object. Overrides MarkdownInterface:: |
|
Markdown:: |
public static | function |
Loads a cached ParsedMarkdown object. Overrides MarkdownInterface:: |
|
Markdown:: |
public static | function |
Parses markdown into HTML. Overrides MarkdownInterface:: |
|
Markdown:: |
public static | function |
Parses the file contents of a markdown file into HTML. Overrides MarkdownInterface:: |
|
Markdown:: |
public static | function |
Parses the contents of a URL containing markdown into HTML. Overrides MarkdownInterface:: |
|
Markdown:: |
public | function | Markdown constructor. | |
StringTranslationTrait:: |
protected | property | The string translation service. | 4 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |