interface MarkdownParserInterface in Markdown 3.0.x
Interface MarkdownInterface.
Hierarchy
- interface \Drupal\Component\Plugin\PluginInspectionInterface
- interface \Drupal\markdown\Plugin\Markdown\MarkdownInstallablePluginInterface
- interface \Drupal\markdown\Plugin\Markdown\MarkdownParserInterface
- interface \Drupal\markdown\Plugin\Markdown\MarkdownInstallablePluginInterface
Expanded class hierarchy of MarkdownParserInterface
All classes that implement MarkdownParserInterface
4 files declare their use of MarkdownParserInterface
File
- src/
Plugin/ Markdown/ MarkdownParserInterface.php, line 11
Namespace
Drupal\markdown\Plugin\MarkdownView source
interface MarkdownParserInterface extends MarkdownInstallablePluginInterface {
/**
* Converts Markdown into HTML.
*
* Note: this method is not guaranteed to be safe from XSS attacks. This
* returns the raw output from the parser itself. If you need to render
* this output you should wrap it in a ParsedMarkdown object or use the
* \Drupal\markdown\Plugin\Markdown\MarkdownParserInterface::parse() method
* instead.
*
* @param string $markdown
* The markdown string to convert.
* @param \Drupal\Core\Language\LanguageInterface $language
* Optional. The language of the text that is being converted.
*
* @return string
* The raw parsed HTML returned from the parser.
*
* @see \Drupal\markdown\ParsedMarkdownInterface
* @see \Drupal\markdown\Plugin\Markdown\MarkdownParserInterface::parse()
*/
public function convertToHtml($markdown, LanguageInterface $language = NULL);
/**
* Retrieves allowed HTML tags, if set.
*
* @return array|null
*/
public function getAllowedTags();
/**
* Retrieves the markdown filter plugin, if set.
*
* @return \Drupal\markdown\Plugin\Filter\MarkdownFilterInterface
*/
public function getFilter();
/**
* Retrieves a filter format entity.
*
* @param string $format
* A filter format identifier or entity instance.
*
* @return \Drupal\filter\FilterFormatInterface|object
* A filter format entity.
*/
public function getFilterFormat($format = NULL);
/**
* Retrieves a short summary of what the MarkdownParser does.
*
* @return array
* A render array.
*/
public function getSummary();
/**
* Retrieves the URL for the parser, if any.
*
* @return string|null
*/
public function getUrl();
/**
* Loads a cached ParsedMarkdown object.
*
* @param string $id
* A unique identifier that will be used to cache the parsed markdown.
* @param string $markdown
* Optional. The fallback markdown to parse if the cached ParsedMarkdown
* object doesn't yet exist. If provided, it will be parsed
* and its identifier set to the provided $id and then cached.
* @param \Drupal\Core\Language\LanguageInterface $language
* Optional. The language of the markdown that is being parsed.
*
* @return \Drupal\markdown\ParsedMarkdownInterface|null
* A ParsedMarkdown object or NULL if it doesn't exist and $markdown was
* not provided as a fallback.
*/
public function load($id, $markdown = NULL, LanguageInterface $language = NULL);
/**
* Loads a cached ParsedMarkdown object for a local file system path.
*
* @param string $id
* A unique identifier that will be used to cache the parsed markdown.
* @param string $path
* The local file system path of a markdown file to parse if the cached
* ParsedMarkdown object doesn't yet exist. Once parsed, its identifier
* will be set to the provided $id and then cached.
* @param \Drupal\Core\Language\LanguageInterface $language
* Optional. The language of the markdown that is being parsed.
*
* @return \Drupal\markdown\ParsedMarkdownInterface
* A ParsedMarkdown object.
*
* @throws \Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException
* When the provided $path does not exist in the local file system.
*/
public function loadPath($id, $path, LanguageInterface $language = NULL);
/**
* Loads a cached ParsedMarkdown object for a URL.
*
* @param string $id
* A unique identifier that will be used to cache the parsed markdown.
* @param string $url
* The external URL of a markdown file to parse if the cached
* ParsedMarkdown object doesn't yet exist. Once parsed, its identifier
* will be set to the provided $id and then cached.
* @param \Drupal\Core\Language\LanguageInterface $language
* Optional. The language of the markdown that is being parsed.
*
* @return \Drupal\markdown\ParsedMarkdownInterface
* A ParsedMarkdown object.
*
* @throws \Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException
* When the provided $url does not exist or is not reachable.
*/
public function loadUrl($id, $url, LanguageInterface $language = NULL);
/**
* Parses markdown into HTML.
*
* @param string $markdown
* The markdown string to parse.
* @param \Drupal\Core\Language\LanguageInterface $language
* Optional. The language of the markdown that is being parsed.
*
* @return \Drupal\markdown\ParsedMarkdownInterface
* A safe ParsedMarkdown object.
*
* @see \Drupal\markdown\ParsedMarkdownInterface
* @see \Drupal\markdown\Plugin\Markdown\MarkdownParserInterface::convertToHtml()
*/
public function parse($markdown, LanguageInterface $language = NULL);
/**
* Parses markdown from a local file into HTML.
*
* @param string $path
* A filesystem path of a markdown file to parse.
* @param \Drupal\Core\Language\LanguageInterface $language
* Optional. The language of the markdown that is being parsed.
*
* @return \Drupal\markdown\ParsedMarkdownInterface
* A ParsedMarkdownInterface object.
*
* @throws \Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException
* When the provided $path does not exist in the local file system.
*/
public function parsePath($path, LanguageInterface $language = NULL);
/**
* Parses markdown from an external URL into HTML.
*
* @param string|\Drupal\Core\Url|\Psr\Http\Message\UriInterface $url
* An external URL of a markdown file to parse.
* @param \Drupal\Core\Language\LanguageInterface $language
* Optional. The language of the markdown that is being parsed.
*
* @return \Drupal\markdown\ParsedMarkdownInterface
* A ParsedMarkdownInterface object.
*
* @throws \Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException
* When the provided $url does not exist or is not reachable.
*/
public function parseUrl($url, LanguageInterface $language = NULL);
/**
* Sets the allowed HTML tags.
*
* @param array $tags
* The allowed HTML tags.
*
* @return static
*/
public function setAllowedTags(array $tags = []);
/**
* Generates a filter's tip.
*
* A filter's tips should be informative and to the point. Short tips are
* preferably one-liners.
*
* @param bool $long
* Whether this callback should return a short tip to display in a form
* (FALSE), or whether a more elaborate filter tips should be returned for
* template_preprocess_filter_tips() (TRUE).
*
* @return string|null
* Translated text to display as a tip, or NULL if this filter has no tip.
*/
public function tips($long = FALSE);
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
MarkdownInstallablePluginInterface:: |
public | function | Retrieves the description of the plugin, if set. | 2 |
MarkdownInstallablePluginInterface:: |
public | function | Displays the human-readable label of the plugin. | 2 |
MarkdownInstallablePluginInterface:: |
public | function | The current version of the parser. | 2 |
MarkdownInstallablePluginInterface:: |
public static | function | Indicates whether the parser is installed. | 2 |
MarkdownInstallablePluginInterface:: |
public | function | Indicates whether the parser is installed. | 2 |
MarkdownInstallablePluginInterface:: |
public static | function | Retrieves the version of the installed parser. | 2 |
MarkdownParserInterface:: |
public | function | Converts Markdown into HTML. | 1 |
MarkdownParserInterface:: |
public | function | Retrieves allowed HTML tags, if set. | 1 |
MarkdownParserInterface:: |
public | function | Retrieves the markdown filter plugin, if set. | 1 |
MarkdownParserInterface:: |
public | function | Retrieves a filter format entity. | 1 |
MarkdownParserInterface:: |
public | function | Retrieves a short summary of what the MarkdownParser does. | 1 |
MarkdownParserInterface:: |
public | function |
Retrieves the URL for the parser, if any. Overrides MarkdownInstallablePluginInterface:: |
1 |
MarkdownParserInterface:: |
public | function | Loads a cached ParsedMarkdown object. | 1 |
MarkdownParserInterface:: |
public | function | Loads a cached ParsedMarkdown object for a local file system path. | 1 |
MarkdownParserInterface:: |
public | function | Loads a cached ParsedMarkdown object for a URL. | 1 |
MarkdownParserInterface:: |
public | function | Parses markdown into HTML. | 1 |
MarkdownParserInterface:: |
public | function | Parses markdown from a local file into HTML. | 1 |
MarkdownParserInterface:: |
public | function | Parses markdown from an external URL into HTML. | 1 |
MarkdownParserInterface:: |
public | function | Sets the allowed HTML tags. | 1 |
MarkdownParserInterface:: |
public | function | Generates a filter's tip. | 1 |
PluginInspectionInterface:: |
public | function | Gets the definition of the plugin implementation. | 4 |
PluginInspectionInterface:: |
public | function | Gets the plugin_id of the plugin instance. | 2 |