djlint / djLint

✨ HTML Template Linter and Formatter. Django - Jinja - Nunjucks - Handlebars - GoLang
https://djLint.com
GNU General Public License v3.0
664 stars 81 forks source link

[BUG] [Formatter] Reformatter adds a space before variable in HTML tag #839

Open PetrDlouhy opened 2 months ago

PetrDlouhy commented 2 months ago

System Info

Issue

I have dynamic heading in my Wagtail template:

<h{{ header_level }}>{{ value }}</h{{ header_level }}>

It gets reformatted to:

<h {{ header_level }}>{{ value }}</h {{ header_level }}>

which breaks the code.

My pyproject.toml:

  [tool.djlint]
  profile="django"
  custom_blocks="cache,scribble,experiment,recursetree,linebreakless,blocktrans"
  custom_html="source,picture,img,defs,symbol,path"