abstract class ExtensibleParser in Markdown 3.0.x
Class ExtensibleMarkdownParser.
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\Core\Plugin\PluginBase uses DependencySerializationTrait, MessengerTrait, StringTranslationTrait
- class \Drupal\markdown\Plugin\Markdown\BaseParser implements MarkdownGuidelinesInterface, MarkdownParserInterface
- class \Drupal\markdown\Plugin\Markdown\ExtensibleParser implements ExtensibleMarkdownParserInterface
- class \Drupal\markdown\Plugin\Markdown\BaseParser implements MarkdownGuidelinesInterface, MarkdownParserInterface
- class \Drupal\Core\Plugin\PluginBase uses DependencySerializationTrait, MessengerTrait, StringTranslationTrait
Expanded class hierarchy of ExtensibleParser
File
- src/
Plugin/ Markdown/ ExtensibleParser.php, line 10
Namespace
Drupal\markdown\Plugin\MarkdownView source
abstract class ExtensibleParser extends BaseParser implements ExtensibleMarkdownParserInterface {
/**
* The Markdown Extension Manager service.
*
* @var \Drupal\markdown\MarkdownExtensionManagerInterface
*/
protected static $extensionManager;
/**
* MarkdownExtension plugins specific to a parser.
*
* @var array
*/
protected static $extensions;
/**
* {@inheritdoc}
*/
public function alterGuidelines(array &$guides = []) {
// Allow enabled extensions to alter existing guides.
foreach ($this
->getExtensions() as $plugin_id => $extension) {
if ($extension instanceof MarkdownGuidelinesAlterInterface) {
$extension
->alterGuidelines($guides);
}
}
}
/**
* {@inheritdoc}
*/
public function getGuidelines() {
$guides = parent::getGuidelines();
// Allow enabled extensions to provide their own guides.
foreach ($this
->getExtensions() as $plugin_id => $extension) {
if ($extension instanceof MarkdownGuidelinesInterface && ($element = $extension
->getGuidelines())) {
$guides['extensions'][$plugin_id] = $element;
}
}
return $guides;
}
/**
* {@inheritdoc}
*/
public function getExtensions($enabled = NULL) {
if (!isset(static::$extensions["{$enabled}:{$this->pluginId}"])) {
static::$extensions["{$enabled}:{$this->pluginId}"] = ($filter = $this
->getFilter()) && $filter
->isEnabled() ? $this
->extensionManager()
->getExtensions($this->pluginId, $enabled) : [];
}
/* @type \Drupal\markdown\Plugin\Markdown\Extension\MarkdownExtensionInterface $extension */
foreach (static::$extensions["{$enabled}:{$this->pluginId}"] as $id => $extension) {
if (isset($this->settings[$id])) {
$extension
->setSettings($this->settings[$id]);
}
}
/** @var \Drupal\markdown\Plugin\Markdown\Extension\MarkdownExtensionInterface[] $extensions */
$extensions = static::$extensions["{$enabled}:{$this->pluginId}"];
return $extensions;
}
/**
* Retrieves the Markdown Extension Manager service.
*
* @return \Drupal\markdown\MarkdownExtensionManagerInterface
*/
protected function extensionManager() : MarkdownExtensionManagerInterface {
if (!static::$extensionManager) {
static::$extensionManager = \Drupal::service('plugin.manager.markdown.extension');
}
return static::$extensionManager;
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
BaseParser:: |
protected | property | The allowed HTML tags, if set. | |
BaseParser:: |
protected | property | The current filter being used. | |
BaseParser:: |
protected | property | The filter identifier. | |
BaseParser:: |
protected | property | The parser settings. | |
BaseParser:: |
public | function |
Converts Markdown into HTML. Overrides MarkdownParserInterface:: |
4 |
BaseParser:: |
public | function |
Retrieves allowed HTML tags, if set. Overrides MarkdownParserInterface:: |
|
BaseParser:: |
public | function |
Retrieves the description of the plugin, if set. Overrides MarkdownInstallablePluginInterface:: |
|
BaseParser:: |
public | function |
Retrieves the markdown filter plugin, if set. Overrides MarkdownParserInterface:: |
|
BaseParser:: |
public | function |
Retrieves a filter format entity. Overrides MarkdownParserInterface:: |
|
BaseParser:: |
public | function |
Displays the human-readable label of the plugin. Overrides MarkdownInstallablePluginInterface:: |
|
BaseParser:: |
public | function |
Retrieves a short summary of what the MarkdownParser does. Overrides MarkdownParserInterface:: |
|
BaseParser:: |
public | function |
Retrieves the URL for the parser, if any. Overrides MarkdownParserInterface:: |
|
BaseParser:: |
public | function |
The current version of the parser. Overrides MarkdownInstallablePluginInterface:: |
|
BaseParser:: |
public static | function |
Indicates whether the parser is installed. Overrides MarkdownInstallablePluginInterface:: |
4 |
BaseParser:: |
public | function |
Indicates whether the parser is installed. Overrides MarkdownInstallablePluginInterface:: |
|
BaseParser:: |
public | function |
Loads a cached ParsedMarkdown object. Overrides MarkdownParserInterface:: |
|
BaseParser:: |
public | function |
Loads a cached ParsedMarkdown object for a local file system path. Overrides MarkdownParserInterface:: |
|
BaseParser:: |
public | function |
Loads a cached ParsedMarkdown object for a URL. Overrides MarkdownParserInterface:: |
|
BaseParser:: |
public | function |
Parses markdown into HTML. Overrides MarkdownParserInterface:: |
|
BaseParser:: |
public | function |
Parses markdown from a local file into HTML. Overrides MarkdownParserInterface:: |
|
BaseParser:: |
public | function |
Parses markdown from an external URL into HTML. Overrides MarkdownParserInterface:: |
|
BaseParser:: |
public | function |
Sets the allowed HTML tags. Overrides MarkdownParserInterface:: |
|
BaseParser:: |
public | function |
Generates a filter's tip. Overrides MarkdownParserInterface:: |
|
BaseParser:: |
public static | function |
Retrieves the version of the installed parser. Overrides MarkdownInstallablePluginInterface:: |
4 |
BaseParser:: |
public | function |
Constructs a \Drupal\Component\Plugin\PluginBase object. Overrides PluginBase:: |
|
DependencySerializationTrait:: |
protected | property | ||
DependencySerializationTrait:: |
protected | property | ||
DependencySerializationTrait:: |
public | function | 2 | |
DependencySerializationTrait:: |
public | function | 2 | |
ExtensibleParser:: |
protected static | property | The Markdown Extension Manager service. | |
ExtensibleParser:: |
protected static | property |
MarkdownExtension plugins specific to a parser. Overrides BaseParser:: |
|
ExtensibleParser:: |
public | function |
Alters existing guides on how to use the Markdown Parser. Overrides MarkdownGuidelinesAlterInterface:: |
|
ExtensibleParser:: |
protected | function | Retrieves the Markdown Extension Manager service. | |
ExtensibleParser:: |
public | function |
Retrieves MarkdownExtension plugins. Overrides ExtensibleMarkdownParserInterface:: |
|
ExtensibleParser:: |
public | function |
Builds a guide on how to use the Markdown Parser. Overrides BaseParser:: |
|
MessengerTrait:: |
protected | property | The messenger. | 27 |
MessengerTrait:: |
public | function | Gets the messenger. | 27 |
MessengerTrait:: |
public | function | Sets the messenger. | |
PluginBase:: |
protected | property | Configuration information passed into the plugin. | 1 |
PluginBase:: |
protected | property | The plugin implementation definition. | 1 |
PluginBase:: |
protected | property | The plugin_id. | |
PluginBase:: |
constant | A string which is used to separate base plugin IDs from the derivative ID. | ||
PluginBase:: |
public | function |
Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the definition of the plugin implementation. Overrides PluginInspectionInterface:: |
2 |
PluginBase:: |
public | function |
Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface:: |
|
PluginBase:: |
public | function | Determines if the plugin is configurable. | |
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. |