I have a Jinja set
directive as follows:
{% set mylist = [
"item 1",
"another item",
"yet another item",
] %}
I would like to add a comment to the second list item. Does Jinja support that? I've tried the following:
{% set mylist = [
"item 1",
"another item", # My comment
"yet another item",
] %}
and
{% set mylist = [
"item 1",
"another item", ## My comment
"yet another item",
] %}
, but none of them work. I'm using Jinja 2.6.
No, Jinja does not support inline comments. However, you can use a comment block:
{#
BUG: Added "another item" because of raisins.
Don't remove it until #12345 is fixed
#}
{% set mylist = [
"item 1",
"another item",
"yet another item",
] %}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With