简体   繁体   中英

Save Laravel 5.4 Markdown Templates to, and retrieve from, database

I'm developing an app that needs to have the ability for users to create custom email templates and also send them built into it.

I like the look of the Laravel 5.4 markdown templates , I could take care of the syntax generation in the front end, and then would ideally like to be able to save them to a database table so that they can be easily maintained by users in the future rather than developers .

So far I have built functionality to save a string containing a markdown template, retrieve it, and pass that string into an emails build() function.

However, I cannot for the life of me find a resource online that can advise how to render that template string correctly in a blade.

Is this even possible?

Any help would be greatly appreciated, I've been coding for less than a year and using Laravel for less than 6 months so apologies if my question is a little amateur or nondescript.

I'm using this to render Markdown

https://github.com/thephpleague/commonmark

So you can do {!! (new \\League\\CommonMark\\CommonMarkConverter())->convertToHtml($source) !!} {!! (new \\League\\CommonMark\\CommonMarkConverter())->convertToHtml($source) !!} where $source is your database data.

Hope it helps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM