Laravel 5.4在Markdown Mailable中错误地混合了HTML组件 [英] Laravel 5.4 wrongly mix HTML components in Markdown Mailable
问题描述
我有普通的Mailable,其中包含一些硬编码的内容.
I had ordinary Mailable that had some hardcoded content.
我已经发布了可发送邮件的视图,将内容更改为markdown并将->view
替换为->markdown
.
I've published mailable views, changed content to markdown and replaced ->view
with ->markdown
.
现在邮件的降价格式很好.
Now mail have nicely formated markdown.
但是Laravel在编译完Markdown之后会选择HTML组件定义,原因是我无法幻像.然后,它使用Markdown版本发送消息,因此将这两种类型混合在单个Mailable markdown视图中!
However Laravel after compiling that markdown will pick HTML component definitions, for reasons I can not phantom. And that after it used Markdown version for message, so it's mixing both kinds in a single Mailable markdown view!
我尝试过:
-
php artisan cache:clear
-
php artisan view:clear
- 将markdown添加到html组件-无法正常工作,Laravel在markdown编译步骤之后使用它们
- 将
->markdown
更改为->markdown
-是的,它将给出关于不存在的方法的错误
php artisan cache:clear
php artisan view:clear
- adding markdown to html components - wont work, Laravel use them past markdown compilation step
- changing
->markdown
to->markdown
- yes it will give error about unexisting method
使用: PHP 7.0,Laravel 5.4.28
Using: PHP 7.0, Laravel 5.4.28
问:是否有任何Laravel全局设置会覆盖->markdown
调用?还有其他想法可能有什么问题吗?
Q: Is there any Laravel global setting that would override ->markdown
call? Any other ideas what may be wrong?
推荐答案
重新阅读文档:
Markdown可邮寄邮件支持刀片模板.刀片仅支持 普通html和刀片语法.
Markdown mailables support Blade templates. Blade support only ordinary html and blade syntax.
单个组件可以使用markdown编译器来解析部分或全部输入.这就是@component('mail::table')
的工作方式.
Individual components can use markdown compilers to parse some or all inputs. That's how @component('mail::table')
works.
更新: Markdown版本用于生成纯文本邮件.其中,作为刀片模板用于生成html版本.同样,可以在刀片模板中显式编译markdown,但这是其支持范围的扩展.
Update: Markdown versions are used to generate plain text mails. Where as blade templates are used to generate html versions. Again, markdown can be compiled explicitly in blade templates, but that's the extend of it's support.
这篇关于Laravel 5.4在Markdown Mailable中错误地混合了HTML组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!