release 1.17.2 (#3135)

* allow to input password interactively in console
* added block to simplify overwriting export template parts
* prevent installation in PHP 8.1
* composer update
* phpunit version to 9
* support negative amounts in excel export
* added system configuration actions for calendar, weekly timesheet, users
* added method to render text with full markdown support
This commit is contained in:
Kevin Papst
2022-02-14 17:33:52 +01:00
committed by GitHub
parent 4cb0ac37a6
commit 83a894823f
37 changed files with 1298 additions and 892 deletions

View File

@@ -10,7 +10,7 @@
namespace App\Utils;
/**
* A simple class to parse markdown syntax and return HTML.
* Parse markdown syntax and return HTML.
*/
final class Markdown
{
@@ -19,20 +19,14 @@ final class Markdown
*/
private $parser;
public function __construct()
{
$this->parser = new ParsedownExtension();
$this->parser->setUrlsLinked(true);
$this->parser->setBreaksEnabled(true);
}
/**
* @param string $text
* @param bool $safe
* @return string
*/
public function toHtml(string $text, bool $safe = true): string
{
if ($this->parser === null) {
$this->parser = new ParsedownExtension();
$this->parser->setUrlsLinked(true);
$this->parser->setBreaksEnabled(true);
}
if ($safe !== true) {
@trigger_error('Only safe mode is supported in Markdown since 1.16.3 to prevent XSS attacks. Parameter $safe will be removed with 2.0', E_USER_DEPRECATED);
}
@@ -42,4 +36,15 @@ final class Markdown
return $this->parser->text($text);
}
public function withFullMarkdownSupport(string $text): string
{
$parser = new \Parsedown();
$parser->setUrlsLinked(true);
$parser->setBreaksEnabled(true);
$parser->setSafeMode(true);
$parser->setMarkupEscaped(true);
return $parser->text($text);
}
}