rcrowe / TwigBridge

Give the power of Twig to Laravel
MIT License
895 stars 165 forks source link

Full example for adding an existing Twig Extension to Laravel8 +TwigBridge? #414

Closed bq14 closed 3 years ago

bq14 commented 3 years ago

I'm starting work on a Laravel8 project that has Twig/Bridge installed.

I'm able to use Twig templates in Laravel. They render normally.

I want to add an existing Twig Filter

"markdown_to_html: The markdown_to_html filter converts a block of Markdown to HTML"
 https://twig.symfony.com/doc/3.x/filters/markdown_to_html.html

which allows using markdown in Twig templates

{% apply markdown_to_html %}
Title
======

Hello!
{% endapply %}

I've been reading this section over and over

https://github.com/rcrowe/TwigBridge#user-content-extensions

I just can't wrap my head around it yet. :-/

For the simple case of getting Twig's existing 'markdown_to_html' extension to "apply" in this Laravel8+twig/bridge setup, what specific changes do I need to make to the Laravel project config?

Any good start-to-finish example available?