added controller to render markdown documentation #129
This commit is contained in:
41
src/Utils/Markdown.php
Normal file
41
src/Utils/Markdown.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Kimai time-tracking app.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace App\Utils;
|
||||
|
||||
use Parsedown as MarkdownParser;
|
||||
|
||||
/**
|
||||
* A simple class to parse markdown syntax and return HTML.
|
||||
*/
|
||||
class Markdown
|
||||
{
|
||||
|
||||
/**
|
||||
* @var MarkdownParser
|
||||
*/
|
||||
private $parser;
|
||||
|
||||
/**
|
||||
* Markdown constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->parser = new MarkdownParser();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $text
|
||||
* @return string
|
||||
*/
|
||||
public function toHtml(string $text): string
|
||||
{
|
||||
return $this->parser->text($text);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user