added controller to render markdown documentation #129

This commit is contained in:
Kevin Papst
2018-02-07 15:07:53 +01:00
parent 2e60e14132
commit 29699572bd
25 changed files with 658 additions and 140 deletions

41
src/Utils/Markdown.php Normal file
View 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);
}
}