Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indent inside filter tag indents the line after the endfilter when trimBlocks is true #1447

Open
viennem opened this issue Aug 23, 2023 · 2 comments

Comments

@viennem
Copy link

viennem commented Aug 23, 2023

When trimBlocks is true, and I use the indent filter inside a filter tag, like this:

{% filter indent(4, true) %}
myLine1
myLine2
{% endfilter %}
myLine3

then the line after the endfilter tag is also indented, and I get this output:

    myLine1
    myLine2
    myLine3

I was expecting this output instead:

    myLine1
    myLine2
myLine3

I am using nunjucks 3.2.4.

@viennem
Copy link
Author

viennem commented Aug 23, 2023

Workarounds:

  1. Change the template like this:

    {% filter indent(4, true) %}
    myLine1
    myLine2
    {%- endfilter %}
    
    myLine3
  2. Or set trimBlocks to false.

@viennem
Copy link
Author

viennem commented Aug 23, 2023

I confirmed that I get the expected output when using jinja instead of nunjucks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant