You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
template language: django default templating language
Issue
I am sometimes using django templating language inside the script tag. When I reformat the code this gets reformatted as well, so I want to ignore that part using {# djlint:off #}. However this is ignored by djlint and it tries to reformat the code resulting in broken javascript code, event {# djlint:off #} gets reformatted as well. Currently I can only ignore the whole script tag, then nothing gets reformated inside the script tag, but as soon as I only want to ignore a specific part inside it, everything gets reformatted, which then also breaks my JS code.
A similar issue was reported, which was fixed in version 1.0.0 #166, however in that previous error the {# djlint:off #} comments itself have not been affected, which is now the case.
<script>{# djlint:off #}{%ifnotopen_form%}console.log('my code that should not be formatted'){%endif%}{# djlint:on #}functionmy_function_that_should_be_indented(){$("#client_form").show();$("#list_users").hide();}</script>
after:
<script>{
# djlint: off #
}{%ifnotopen_form%}console.log('my code that should not be formatted'){%endif%}{
# djlint: on #
}functionmy_function_that_should_be_indented(){$("#client_form").show();$("#list_users").hide();}</script>
System Info
Issue
I am sometimes using django templating language inside the script tag. When I reformat the code this gets reformatted as well, so I want to ignore that part using
{# djlint:off #}
. However this is ignored by djlint and it tries to reformat the code resulting in broken javascript code, event{# djlint:off #}
gets reformatted as well. Currently I can only ignore the whole script tag, then nothing gets reformated inside the script tag, but as soon as I only want to ignore a specific part inside it, everything gets reformatted, which then also breaks my JS code.A similar issue was reported, which was fixed in version 1.0.0 #166, however in that previous error the
{# djlint:off #}
comments itself have not been affected, which is now the case.How to Reproduce
I run
djlint --reformat --format-js server/templates/
and get:Contents of .djlintrc/pyproject.toml [tool.djlint]
The text was updated successfully, but these errors were encountered: