mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-19 16:10:00 +00:00
Better implementation of markdown.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
This commit is contained in:
@@ -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
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user