mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-11-30 04:33:54 -06:00
Better implementation of markdown.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
This commit is contained in:
parent
8c675615df
commit
0d87f7c4ca
@ -17,13 +17,11 @@ use Carbon\Carbon;
|
||||
use ExpandedForm;
|
||||
use FireflyIII\Http\Requests\PiggyBankFormRequest;
|
||||
use FireflyIII\Models\AccountType;
|
||||
use FireflyIII\Models\Note;
|
||||
use FireflyIII\Models\PiggyBank;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface;
|
||||
use Illuminate\Support\Collection;
|
||||
use Input;
|
||||
use League\CommonMark\CommonMarkConverter;
|
||||
use Log;
|
||||
use Preferences;
|
||||
use Session;
|
||||
@ -349,11 +347,7 @@ class PiggyBankController extends Controller
|
||||
*/
|
||||
public function show(PiggyBankRepositoryInterface $repository, PiggyBank $piggyBank)
|
||||
{
|
||||
/** @var Note $note */
|
||||
$note = $piggyBank->notes()->first();
|
||||
$converter = new CommonMarkConverter;
|
||||
$note->text = $converter->convertToHtml($note->text);
|
||||
|
||||
$events = $repository->getEvents($piggyBank);
|
||||
$subTitle = e($piggyBank->name);
|
||||
|
||||
|
@ -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
|
||||
*/
|
||||
|
@ -92,7 +92,7 @@
|
||||
<h3 class="box-title">{{ trans('form.notes') }}</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
{{ note.text|raw }}
|
||||
{{ note.markdown|raw }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user