mirror of
https://github.com/standardebooks/web.git
synced 2025-07-15 02:46:46 -04:00
Add Formatter::MarkdownToInlineHtml()
HTML without the surrounding `<p>` tags will be useful to show placeholder notes to admins on the wanted ebooks page. Examples of generating block-level and inline HTML: https://github.com/erusev/parsedown/wiki/Tutorial:-Get-Started
This commit is contained in:
parent
9652d63b12
commit
0359119a11
1 changed files with 12 additions and 0 deletions
|
@ -108,6 +108,18 @@ class Formatter{
|
|||
return Formatter::$_MarkdownParser->text($text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a string of Markdown into inline HTML.
|
||||
*/
|
||||
public static function MarkdownToInlineHtml(?string $text): string{
|
||||
if(!isset(Formatter::$_MarkdownParser)){
|
||||
Formatter::$_MarkdownParser = new Parsedown();
|
||||
Formatter::$_MarkdownParser->setSafeMode(true);
|
||||
}
|
||||
|
||||
return Formatter::$_MarkdownParser->line($text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a number of bytes, return a string containing a human-readable filesize.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue