grafana / oncall

Developer-friendly incident response with brilliant Slack integration
GNU Affero General Public License v3.0
3.42k stars 274 forks source link

How to avoid newlines in Jinja? Docs + optional jinja function #3317

Open Matvey-Kuk opened 10 months ago

Matvey-Kuk commented 10 months ago

What would you like to see!

Customers are struggling with newlines when they are writing complicated Jinja templates with if's and else's. They format code with newlines & those newlines show up in the rendered results because that's the way Jinja works.

The problem I see is that user was confused & were not able to find the right answer to his question "how to avoid new lines".

I propose: Improve documentation https://grafana.com/docs/oncall/latest/jinja2-templating/ & address this issue, maybe add Jinja function to trim new lines so users will be able to use it explicitly, add it to the cheetsheet in the product.

Product Area

Alert Flow & Configuration

Anything else to add?

No response

github-actions[bot] commented 10 months ago

The current version of Grafana OnCall, at the time this issue was opened, is v1.3.55. If your issue pertains to an older version of Grafana OnCall, please be sure to list it in the PR description. Thank you :smile:!