Better implementation of markdown.

Signed-off-by: James Cole <thegrumpydictator@gmail.com>
This commit is contained in:
James Cole
2016-10-22 11:50:33 +02:00
parent 8c675615df
commit 0d87f7c4ca
3 changed files with 15 additions and 8 deletions

View File

@@ -14,6 +14,7 @@ declare(strict_types = 1);
namespace FireflyIII\Models;
use Illuminate\Database\Eloquent\Model;
use League\CommonMark\CommonMarkConverter;
/**
@@ -43,6 +44,18 @@ class Note extends Model
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
protected $fillable = ['title', 'text'];
/**
* @param $value
*
* @return string
*/
public function getMarkdownAttribute(): string
{
$converter = new CommonMarkConverter;
return $converter->convertToHtml($this->text);
}
/**
* Get all of the owning noteable models. Currently only piggy bank
*/