public function Markdown::tips in Markdown 8
Same name and namespace in other branches
- 3.0.x src/Plugin/Filter/Markdown.php \Drupal\markdown\Plugin\Filter\Markdown::tips()
Generates a filter's tip.
A filter's tips should be informative and to the point. Short tips are preferably one-liners.
@todo Split into getSummaryItem() and buildGuidelines().
Parameters
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 value
string|null Translated text to display as a tip, or NULL if this filter has no tip.
Overrides FilterBase::tips
File
- src/
Plugin/ Filter/ Markdown.php, line 105
Class
- Markdown
- Provides a filter for markdown.
Namespace
Drupal\markdown\Plugin\FilterCode
public function tips($long = FALSE) {
if ($long) {
return $this
->t('Quick Tips:<ul>
<li>Two or more spaces at a line\'s end = Line break</li>
<li>Double returns = Paragraph</li>
<li>*Single asterisks* or _single underscores_ = <em>Emphasis</em></li>
<li>**Double** or __double__ = <strong>Strong</strong></li>
<li>This is [a link](http://the.link.example.com "The optional title text")</li>
</ul>For complete details on the Markdown syntax, see the <a href="http://daringfireball.net/projects/markdown/syntax">Markdown documentation</a> and <a href="http://michelf.com/projects/php-markdown/extra/">Markdown Extra documentation</a> for tables, footnotes, and more.');
}
else {
return $this
->t('You can use <a href="@filter_tips">Markdown syntax</a> to format and style the text. Also see <a href="@markdown_extra">Markdown Extra</a> for tables, footnotes, and more.', [
'@filter_tips' => Url::fromRoute('filter.tips_all')
->toString(),
'@markdown_extra' => 'http://michelf.com/projects/php-markdown/extra/',
]);
}
}