Closed pluiedev closed 1 year ago
mm, ok, it makes sense. Maybe a echo
(or print
) tag?
{{ echo |> strip_indent |> md }}
Something something main text, [some link](https://vento.js.org),
some pictures ![some alt text](https://some.site/img/271a237b.png)
{{ /echo }}
I'm thinking of maybe echo
overlaps raw
(https://vento.js.org/syntax/raw/)
So I propose to replace raw
with echo
(both works similar but echo
would allow to use filters). Thus, we don't have to add another tag.
New version released (0.8.0). Now you can do:
{{ echo |> md }}
Something something main text, [some link](https://vento.js.org),
some pictures ![some alt text](https://some.site/img/271a237b.png)
{{ /echo }}
Currently, there's no real easy way to apply a filter to a text block in Vento, which makes things like using Markdown for long body text quite painful. The best solution I've thought of so far is to assign text to a variable first and then printing it with filters:
But this gets annoying if you need to do this often, like I do. It would be nicer if there's a tag that directly applies some text to some filters and then prints them, with filter chaining of course:
There are some drawbacks to this approach - after all, Vento is supposed to be a lot simpler than similar template engines, so a new tag isn't always the brightest idea.
Maybe we should also allow functions that are supposed to take text blocks to have a similarly simple syntax? This is also something you have to do at the moment, which resembles this problem a lot:
I'm not exactly sure what's the best approach here, but it's something I run into so often that I wrote my own helper tag to make my life easier. Hope we can have something like that upstreamed.