iby / twig-js-markdown

Markdown extension for twig.js
8 stars 2 forks source link

Allow matching PHP syntax #4

Closed RobLoach closed 5 months ago

RobLoach commented 7 months ago

Allow using a syntax that matches PHP's filters.... https://twig.symfony.com/doc/3.x/filters/markdown_to_html.html

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

Hello!
{% endapply %}
{{ include('some_template.markdown.twig')|markdown_to_html }}

{{ changelog|markdown_to_html }}
iby commented 7 months ago

Hey @RobLoach, thanks for the suggestion! I haven't used this project in a while and won't have time in the near future to support it. You're more than welcome to make a PR and I can have a look then.

I'm guessing PHP filters is the | piping symbol? I very vaguely remember what's going on here, but there were some differences between Twig.js and the original Twig when I first looked into it ages ago. If it has caught up with the latest Twig version and allows that piping, it should be fairly easy to add that support here.

RobLoach commented 7 months ago

Cool! Glad you're down on allowing it via the filter. I'm happy to help out. Will be speaking with the rest of the team on it later this week.

RobLoach commented 6 months ago

Just following up on this. I've made some progress on this, and it's kind of working, but I haven't written the tests in yet. I'll be sure to open up a PR once it's good.

iby commented 6 months ago

Super! Tests – yes please! 🙏😊