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
Have you looked at how the textarea you have defined would look like in a browser? textarea is sensitive to indenting, so it does not makes sense for djlint to format it imo, and that's why djlint (intentionally, I think) has textarea in its ignored_blocks.
EDIT: So your code should be
<formmethod="post"><textareaname="code">{%- if object.code -%}{{- object.code -}}{%- endif -%}</textarea><input></form>
Not nice, but fine, and I don't see an actually better way.
Okay. I did not know about that. Apparently Jinja also has some env variables which might affect whitespace handling.
Then my best guess to make your specific case work you would need djlint to respect jinja whitespace-removal by template tags in multiple places. Such that a textarea block which both starts and ends with whitespace-removal will be indented like normal html blocks.
If you wanna take a shot I would look for something like ignored_blocks and regexes which include textarea (obviously). Might be just a couple of lines and a test case (which you already have).
System Info
djlint --version
): 1.35.2Issue
Multiline
<textarea>
block dedent completely.DJLint formats the code as follows:
But I expect lie this:
How To Reproduce
Try to format the code above. Settings are default.
The text was updated successfully, but these errors were encountered: