rinja-rs / rinja

A template rendering engine based on Jinja, generating type-safe Rust code at compile time.
https://rinja.readthedocs.io
Apache License 2.0
116 stars 10 forks source link

Make it possible to return "safe" content from filters #51

Closed GuillaumeGomez closed 2 months ago

GuillaumeGomez commented 3 months ago

We could for example add an enum to ensure that, for example:

enum NeedsEscape<T> {
    Yes(T),
    No(T),
}

Where NeedsEscape::Yes would be the default. Then it'd just be a matter of implementing From<T: Display> for NeedsEscape to keep it working for most cases. And in case someone want to add a filter that returns content that should not be escaped, they can.

What do you think @Kijewski ?