NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI
PyPI, #2008 most downloaded on PyPI
HTML template linter and formatter (Django, Jinja, Twig, Nunjucks, Handlebars, Mustache, Liquid, Go templates, Angular, Tera, Askama, Mako)
Latest stable
1.50.4
Last release 7 days ago
15 Nov 2026
Ships fairly regularly
a new release about every 1 weeks
Nearly every release is documented
notes for 60 of the last 60 stable releases
1 version withdrawn
withdrawn after publishing
5 years old
238 releases · first in 2021
Drag across the ruler to compare, or tap a release to open it.
include turns on a rule that the profile leaves out, so --include=T003 now runs T003 without a profile or under --profile=html . Before, the template
include turns on a rule that the profile leaves out, so --include=T003 now runs T003 without a profile or under --profile=html. Before, the template rules (T) and the rules for one template language (D, J, M, N) stayed off there, whatever include said. A rule still stays off under a profile it doesn't apply to, such as T028 under django or H012 under angular.--profile=html. A custom rule with an exclude list used to be skipped there, as under all.djlint --help and the docs no longer call html the default profile. Without one, djLint formats the template syntax of every language, as all does, and lints as html does.Lower the minimum required dependency versions to the oldest ones djLint works with. 1.50.2 raised some of them because of problems in those packages,
Your coding agent can read these notes before it upgrades. Set up the MCP server →
Raise the minimum required dependency versions to ones that work on Python 3.11, djLint's oldest supported version:
.gitignore line such as build\ without an error.The error for a .djlint_rules.yaml that isn't valid YAML fits on one line. It ran over three, and editors that show the last line of a failure showed
.djlint_rules.yaml that isn't valid YAML fits on one line. It ran over three, and editors that show the last line of a failure showed only where in the file the problem was.]) }}, the line lines up with the line that opened that bracket. It used to line up with the tag.With Click 8.5.1 or newer, djlint --help no longer lists a blank SRC ... row under "Other". The files to check are still shown in the usage line.
djlint --help no longer lists a blank SRC ... row under "Other". The files to check are still shown in the usage line.2, because that file went unchecked. --github-output adds an error annotation on the file, and --sarif reports it as a notification on a run marked as not successful.pyproject.toml, djlint.toml or .djlintrc with a syntax error or a file named by --configuration, is now a usage error that exits 2. djLint used to print a red line and check the templates against its defaults, so the run could pass. The same goes for a number setting with a value that isn't a number, such as max_line_length = "wide", and for a .djlint_rules.yaml that isn't valid YAML or doesn't hold a list of rules, which crashed with a traceback. An empty .djlint_rules.yaml no longer crashes. In the Python API, load_config raises click.UsageError for these.130, as shells report an interrupted command, rather than 1, which means djLint found something. The same goes for djlint --lsp.Ship a py.typed marker, so type checkers read the annotations of djlint.api .
py.typed marker, so type checkers read the annotations of djlint.api.djlint.api no longer builds the command line, which takes a little off the start of editors and other programs that use djLint from Python. The command line moved out of the djlint package itself, which still hands out main, process and process_stdin when they are asked for.A U+2028, U+2029, U+0085 or form feed in the arguments of a call or the value of a {% set %} that is not JSON, as in a string passed to {{ url("…", x)
{% set %} that is not JSON, as in a string passed to {{ url("…", x) }}, is kept as written. It was rewritten as a line break, which changed the string.kind, as in <track kind=""> or <track kind>. Browsers read an empty kind as metadata, not subtitles, so such a track carries no captions. H057 took it for a subtitles track.djlint.toml, .djlintrc or the file --configuration names. It always said pyproject.toml.A mako profile for Mako templates. Mako needs a control line, such as % if x: or % endfor , and a ## comment to start a line of their own, and other p
mako profile for Mako templates. Mako needs a control line, such as % if x: or % endfor, and a ## comment to start a line of their own, and other profiles joined them onto other lines, which broke the template. Under the mako profile they always keep their own lines, and the lines between % if and % endif, or between a <%block> or <%def> tag and its closing tag, are indented like any other block. The code in a ${} expression is left as written, and so are the attributes of a tag that depend on control lines, Python blocks, <%doc> and <%text>, and a script or style holding Mako syntax under --format-js or --format-css. The linter runs the HTML rules. The all profile handles Mako's lines the same way.{% apply %}, {% sandbox %} and {% guard %} blocks and Django's old {% ifequal %} and {% ifnotequal %} blocks indent their contents like other blocks.max_line_length = [100] or "indent": null, is reported and falls back to its default, as a string that is no number already did. djLint failed instead.{% endtoc %}, or a stray {% endif %}, stays at the level of the markup around it. It moved one level to the left, and so did everything after it.{{ _("Hello " "world") }} or {% set x = "a" "b" %}, or in triple quotes, keeps its quotes. They were dropped, which left {{ _(Hello world) }}, a variable name rather than a string.${ that never close no longer slows formatting down. Three thousand of them in one paragraph took ten seconds and now take a tenth of one.djLint warns about a setting that has no effect: max_blank_lines together with preserve_blank_lines , which takes precedence, and --prefer-configurati
max_blank_lines together with preserve_blank_lines, which takes precedence, and --prefer-configuration without --configuration. The warning goes to stderr once per run, so the language server does not repeat it on every change.>, as in </p at the end of a line, again runs to the next >, as browsers read it. Since 1.49.5, the tag on the next line was taken for an opening tag, so each paragraph after such a line was indented one level deeper than the one before.djlint --help groups the options by what they are for: modes, files, configuration, the linter, output, layout, rewrites, and CSS and JavaScript. They
djlint --help groups the options by what they are for: modes, files, configuration, the linter, output, layout, rewrites, and CSS and JavaScript. They used to come in one long list in no particular order.A file with many tags that are never closed formats in under a second. A thousand lines that each start with , or tags that are never closed no longer
<p data-x="a took 40 seconds, 1,500 lines of <p took over a minute, and 2,000 ran out of memory. Thousands of <script>, <style> or <textarea> tags that are never closed no longer slow down formatting or linting either: linting 4,000 of them took up to 23 seconds.--format-js leaves a <script> alone when its type is neither JavaScript nor JSON, such as a client-side template in <script type="text/template">. It was formatted as JavaScript, which broke the template. Scripts without a type, modules, text/babel and JSON types such as application/ld+json are formatted as before.<script> or <style> tag with attributes too long for one line has them spread over lines also when its contents take several lines, as any other tag does. With --format-js or --format-css, one run spread them and the next joined them again.--format-js or --format-css, the contents of a script or style that follows other markup on its line, as in <span>a</span><script>, are indented below that line. After </noscript><script>, the next run indented the rest of the file one level deeper.--format-js, JavaScript that js-beautify lays out differently on each run, such as a ternary written over several lines, settles on one layout, so a second run leaves it alone.--format-css no longer takes a <style inside a JavaScript string, as in new RegExp("<style(.*?)>"), for a style tag. It formatted the rest of the script as CSS.--format-js and --format-css no longer read a <script> or <style> written inside an HTML comment, as in <!-- <script> -->, as the start of a block. Everything from it to the next real closing tag was formatted as JavaScript or CSS.djlint --help describes each option more clearly. It now gives the defaults that come from .editorconfig, lists the all profile, and names what a value holds, such as --ignore CODES. --warn no longer claims to turn errors into warnings: it only changes the exit code. The configuration page uses the same wording.--max-blank-lines say that it has no effect with --preserve-blank-lines, which keeps every blank line.A template with hundreds of lines that each open a {{, {% set %} or {% include %} left unclosed, as in {{ 'a on every line, formats in well under a se
{{, {% set %} or {% include %} left unclosed, as in {{ 'a on every line, formats in well under a second. Four hundred such lines took from 45 seconds to seven minutes. Linting such lines with T002 no longer slows down the same way.<script {%a%}{%a%}…>, formats and lints in well under a second. It took tens of seconds.djlint --check passes right after djlint --reformat.--max-line-length, its indentation and any text beside it included. A line that fit only without its indentation was joined, and the next run spread its attributes.--max-attribute-length once a style or srcset value loses its trailing ; or extra spaces stays on one line. It was spread, and the next run joined it again.{% blocktrans trimmed %} inside a {% filter %} no longer ends the filter early. Everything after it lost its indentation, and the next run indented the {% endfilter %} again.<script> or <style> written across lines, whose attributes are longer than --max-attribute-length, has them spread when it is put on one line. It took a second run.{{ }}, {% %} or mako ${ } that spans lines, as in HTML('<a class="x" href="y">') on a line of its own, no longer has its attributes spread over several lines. That put line breaks into the string, which in mako is an error, and the next run moved them again.value="{{ _("Students' list") }}" or mako's value="${_("Students' list")}", no longer upsets the layout of the lines that follow. The quote was read as the end of the value and the apostrophe as the start of another.<button "="" title="x"> or id="a"", no longer stops djLint from reading the tags after it. Only a quote after = opens a value, as browsers read it. Before, the rest of the file was skipped: the linter reported its elements as orphans (H025) and the formatter indented them differently on each run. A quote inside a bare value, as in title=a'b, is part of the value for the same reason.> in a string of a template tag inside an attribute value, as in data-x="{{ "a > b" }}", no longer ends the tag. The formatter took out the space beside it, which changed the string.class="{{ "a b" }}", closed up "a = b", joined a line break in a string in a style or srcset, split a style at a ; or a srcset at a , inside a template tag, and with --format-js or --format-css took a > in one for the end of the <script> or <style> tag.--max-line-length, as the rule for long lines intends. A lone style was split at each ;, and the next run could join it again.style or srcset attribute that has no value no longer stops the formatter with an error when its attributes are spread over several lines.type="text/javascript" or type="text/css" is dropped, and a form's method lowercased, also when the value is written without quotes or with spaces around =. It used to take a second run.{{, with }} on a line of its own, stays where it was written. It used to be pulled up onto the {{ line with its arguments a level too deep, which the next run corrected.{% set %} or {% trans %}, is kept, also when the string holds a %}, {%, }} or {{, or a comment before it holds a quote. It was stripped or replaced with indentation, which changed the string.{% if x %} followed by {{ _('Deleted') }} on its own line. It used to be put on one line.type only where it is the element's default: text/javascript on a <script>, and text/css on a <style> or a <link rel="stylesheet">. A <script type="text/css">, a <style type="text/javascript">, a custom element such as <script-x>, and a <link> that is not a stylesheet keep theirs, as does a <link> whose rel a template tag helps write or comes after one (a rel inside a {# #} comment does not count). So does an attribute with a longer name, such as @type or @method. A type or method next to a template tag written with -, as in {{- x }}, is left as written, since dropping the type would join what the - trims. H024 reports the same cases, also when the value is written without quotes or with spaces around =.type is kept when the browser might not read it: when another type follows in the same tag, as in <script type="text/javascript" type="module">, since a browser reads the first one, and when a template tag that may write a type of its own follows, as in <script type="text/javascript" {{ attrs }}>. A template tag that is part of a value, as in src={{ url }} or data-x="{{ "a > b" }}", does not count, and neither does text inside a string of a template tag, as in {{ '}} type=text/javascript' }}. A default type written twice, as in type="text/javascript" type=text/javascript, is dropped both times in one run.<div class="x" {# note #}>, is kept. With a profile that has {# #} comments, the formatter deleted it.-, as in class=x {{- suffix }} or class={{ c -}} x, stays unquoted. The - joins the text beyond it onto the value, and quoting the value left that text outside, which changed the attribute.<option value="x"{% if a %} selected{% endif %}> or <li{{ attrs }}>, stays there when the attributes are spread over several lines. A line break or space was put between them, which the page then rendered.H056 no longer reads a src written inside a template tag, as in <img {% if src %}class="a"{% endif %} src="a.png">, as an empty src of the tag.A {% set %} written across lines indents the arguments of a function call inside it, as it already did for the items of a list or dict (#2819). Its la
{% set %} written across lines indents the arguments of a function call inside it, as it already did for the items of a list or dict (#2819). Its last line stays at the level of the value when it holds part of the value, the lines after the tag are no longer one level too shallow when a bracket opened inside it closes on its last line, a bracket inside a quoted string no longer changes the indentation, and a line that goes on with a string started on the line before is no longer indented, which put spaces into the string.Checking or linting a folder of many templates takes about half the time, most of all on Windows. A small run no longer starts worker processes, which
--use-gitignore."="" can leave in a template, no longer takes minutes to format.The language server no longer loses the settings of an editor that took over five seconds to answer, and updates the findings of open documents once t
exclude applies in the language server as it does to djlint <folder>: a document in vendor/ of a folder with no pyproject.toml was not left out.configuration or rules, when a document is opened or saved, also in editors that don't watch files, and updates every open document then.python_module rule that returns a code, match or message that isn't a string gets a clear error.djlint --lsp runs a language server, for findings as you type and formatting in any editor that supports LSP. See Language server.
djlint --lsp runs a language server, for findings as you type and formatting in any editor that supports LSP. See Language server.djlint.api.is_excluded() tells whether the configuration leaves out a file.--stdin-filename, djLint formats the text it is given even if the configuration sets files. It formatted those files instead, so an editor formatting a template rewrote them and left the template as it was.--stdin-filename honors exclude, extend-exclude and --use-gitignore: the text of an excluded file comes back unchanged, with no findings.A long run of $ before a tag no longer makes linting slow: a line of two hundred thousand of them went from 2.2 seconds to 0.15. Formatting such a lin
$ before a tag no longer makes linting slow: a line of two hundred thousand of them went from 2.2 seconds to 0.15. Formatting such a line is still slow.Add djlint.api, a supported way to format and lint text from Python: load_config(), format_text() and lint_text(), which returns findings with numeric
djlint.api, a supported way to format and lint text from Python: load_config(), format_text() and lint_text(), which returns findings with numeric positions. See Python API.--linter-output-format takes {end}, SARIF reports endLine and endColumn, and GitHub annotations cover the whole finding. A custom rule's python_module can return end, and otherwise ends where its match does.python_module is also looked for in the project root, after everything else on the path, so it works with the djlint command as well as with python -m djlint.python_module rule that returns a line that isn't a position now stops djLint with an error naming the rule, instead of a traceback from the report.<li><a …> or Read the <a …>, is laid out from that line. The attributes line up under the first one, or with --single-attribute-per-line sit one indent in from the line with the closing > at the line's indent. They used to be indented as if the tag started the line, so they landed left of the tag, or a single space in after text.preserve-inline in the js setting brace_style takes effect, so { bubbles: true } stays on one line in a or in an attribute formatted with --format-att
preserve-inline in the js setting brace_style takes effect, so { bubbles: true } stays on one line in a <script> or in an attribute formatted with --format-attribute-js-json. It used to be dropped before the code was formatted.css and js, so a strict validator such as Tombi no longer reports indent_size there.New option --sort-load-tags / sort_load_tags sorts the libraries in a {% load %} tag and drops the ones written twice, so {% load static i18n %} becom
--sort-load-tags / sort_load_tags sorts the libraries in a {% load %} tag and drops the ones written twice, so {% load static i18n %} becomes {% load i18n static %}. In {% load a b from library %} the names before from are sorted. It is off by default: where two libraries define a tag or filter of the same name, the one loaded last wins, so sorting can change which one a template uses.H012 reports around an attribute's =, so <div class = "a"> becomes <div class="a">.H010 reports the names the formatter lowercases, in any mix of case, so Width="3" is now reported. A framework binding such as :itemID or @ID and a longer name such as data-ID no longer are, since the formatter leaves their case alone.H018 is not reported under --close-void-tags, since the formatter then writes the /> ending the rule reports. --ignore-case already worked this way for H009 and H010.H020 reports an empty pair whose end tag has whitespace before its >, such as <div></div\n>.H026 reports a class or id holding only whitespace, such as class=" ", and one written with spaces around the =.H033 reports an action padded at both ends once. It used to report it twice, unless an attribute before action happened to make the two reports look the same.<p title="<img src='a'>">, is text, and H005, H008, H010, H012, D018, J018, H024, H026, H029 and H033 no longer report it. H046 and H051 read tabindex and role from the tag's own attributes, so tabindex=1 written in a value or in the page text is not reported either.T001 and T027 read a tag holding a dict, such as {{ f({"a": {"b": 1}}) }}, up to the }} that closes it rather than the first }} inside it.T032 steps over an escaped quote in a string, so the spaces in {{ x|default:"a \"b c\"" }} are not reported.H015 reports a heading followed by a tag on the same line anywhere in the file. It used to look only at the last line.{{{attrs}}} and a dict as in {{ {'class': 'x'}|xmlattr }}, so <img {{ attrs }} src='a'> is reported by H008, which used to stop reading at the {{.T038 steps over a string in a block tag, so the {% in {% with a="{%" %} does not cut the tag short.<, and H015, H030, H036, T001, T027, T038 and T039 no longer read the rest of the document again for each tag. A file holding thousands of unclosed tags or headings on one line is linted in a fraction of a second, where it used to take minutes.Ship the license of the mypyc runtime, which the binary wheels include, in LICENSE-THIRD-PARTY.
LICENSE-THIRD-PARTY.Drop support for EoL Python 3.10.
A line that opens a template block now indents the lines inside it when the rest of the line looks like a single-line html tag. Before, html in a stri
{% call modal("<strong>" ~ n ~ "</strong>") %}, or inline html right after the opening tag, as in {% if a %}<b>x</b>, left the block's contents at its own level, and its closing tag ended up one level too far out.A long run of unclosed {{ or {% no longer makes linting and formatting quadratic. Each was read again from every opener to the end of the line or the
{{ or {% no longer makes linting and formatting quadratic. Each was read again from every opener to the end of the line or the file, so eight thousand {{ on one line took over half a minute to lint and as long again to format, and twenty thousand in one attribute value took H054 alone 80 seconds; each now takes well under a second. A second opener is taken to mean the first one never closed, which is how the tokenizer already read them. T038 still reads an unclosed {% up to the next %}, as django does, so a run of those stays slow there.> inside a string of a template tag no longer ends the html tag around it when the string reuses the attribute's quote, as in class="{{ classes|default:"[&>a]:flex" }}". Before, the linter lost the rest of the tag, so H037 missed a repeated attribute after it, and the formatter put a line break inside the string.H054 no longer reads an attribute out of a {# #} comment in another attribute's value, as in <a title="{# " href #}">, and leaves an input alone when an {% if %} writes its type and another tag writes the value, as in {% if shown %}type="{% if hidden %}hidden{% else %}text{% endif %}"{% endif %}.{# inside a {{ }} or {% %} tag, as in {{ "{# x" }} or an ICU message such as {n, plural, one {# item} other {# items}}, no longer opens a comment that runs to the next #} in the file. Before, the linter skipped everything in between, so T038 reported the {% if %} before it as unclosed and T041 missed an {% extends %} after it, and the formatter left the lines in between unformatted. A tag ends at its first closing delimiter, which is where django ends it.Each option on the configuration page now carries the release that brought it, so a reader held to an older djLint can tell at a glance what is there
A second {# #} comment on a line no longer swallows everything back to the first one, so a tag written between two comments is formatted and linted li
{# #} comment on a line no longer swallows everything back to the first one, so a tag written between two comments is formatted and linted like any other. Before, it kept lines past --max-line-length and hid findings from the rules. A comment now ends at its first #}, which is where django, jinja and nunjucks end it.New rule T041 reports an {% extends %} that is not the first tag in the template, which django refuses to compile and which leaks whatever text comes
T041 reports an {% extends %} that is not the first tag in the template, which django refuses to compile and which leaks whatever text comes before it into the page. A {# #} comment before it is left alone, as is anything inside a {% comment %}, {% raw %} or {% verbatim %} block, named or not, a {# djlint:off #} region or yaml front matter. An html comment is reported, since it is written into the page ahead of the parent template's doctype, and so is a branch tag on the django profile, where {% if x %}{% extends "a.html" %}{% endif %} does not compile; jinja documents that form and keeps it.T042 reports text or html written after {% extends %} and outside every {% block %}, which the engine silently discards. A template tag there still runs and is left alone, as are comments and the body of a {% macro %}.T043 reports a block name used more than once in a template, which Django, Jinja and Nunjucks all refuse to parse, even where the two blocks sit in different branches of an {% if %}. A {% blocktrans %}, a named {% endblock %}, a block inside a template comment, a {% comment %} block or a {% raw %} or {% verbatim %} body, and the blocks an {% embed %} fills in another template are left alone; a block inside an html comment or a <script> counts, since the engine still parses it.T044 reports a statement keyword inside an output tag, such as {{ if x }}, {{ url 'home' }} or {{ endif }}, where a {% %} block tag was meant. A bare keyword such as {{ url }} is an ordinary variable and is left alone, as is an expression that merely starts with one of the names, such as {{ url ~ "/x" }}, {{ url ? url : '#' }} or {{ block ('title') }}, and so is the body of a {% raw %} or {% verbatim %} block, named or not.T045 reports a statement tag, such as {% include %} or {% if %}, written inside an html comment, where it still runs. A value printed into a comment, as in <!-- built {{ version }} -->, is left alone, and so is a bare Go keyword such as <!-- period {{ start }} to {{ end }} -->, which is an ordinary variable under every other profile, and a {% under handlebars and golang, which have no such syntax. A tag inside a template comment, a {% comment %} block or a raw block is left alone whether it is written with whitespace control, tabs or a named closing tag, as is one inside an Internet Explorer conditional comment, in any case and closed by its <![endif]-->; one left unclosed is the ordinary comment a browser reads it as and is reported.H053 reports an id used more than once in the file, which breaks getElementById, <label for> and fragment links. Two ids in exclusive branches of one {% if %} are never both rendered and are not reported, whichever language writes the branch, and neither are two ids in separate <template> fragments; a value written by a template tag is left alone.H054 reports an interactive element nested inside another, such as a <button> inside an <a href> or a link inside a button. An <a> without an href is not interactive and is left alone, as is a hidden input or one whose type a template tag writes.H055 reports a lang on <html> that is not a language tag, such as lang="english", lang="en_US" or a value that is only whitespace, which H005 reads as present. An empty value is left to H005, and so is a value written by a template tag or by a php short echo, as in lang="<?= $lang ?>", while a value that merely starts with $ or {, such as lang="$LANG", is read as written. A > written inside a template tag ahead of the attribute, as in {% if a > b %}, does not hide it.H056 reports an empty src on an element that fetches what it names, such as <img src=""> or <script src=""></script>, which a browser resolves to the page itself. A src with no value at all counts too, while an unquoted value such as src=/static/logo.png, a value written by a template tag, a value that is only whitespace, and the separate srcset and data-src attributes are left alone.H057 reports a <video> with no captions track, which WCAG 1.2.2 requires for prerecorded video with sound. A <track> of kind captions or subtitles counts, as does one with no kind, since subtitles is the default, while a commented out track and one written inside an attribute value do not; a muted video is left alone, as is one whose tracks or attributes a template tag may write, meaning a real {{, {%, {# or ${ rather than the brace of a css value or the $ of a jQuery handler or a price.--sarif writes the findings as a SARIF 2.1.0 document, which GitHub code scanning, Azure DevOps and most editors read, so a run can be uploaded and kept in the Security tab with history rather than shown only as annotations on one pull request. With --check, a file that would be reformatted is reported under a formatting rule.<% %> or <%! %> code block is left as written, since its body is python rather than markup. Formatting re-indented it, flattening a return "unit" inside an if to the start of the line and leaving python that no longer parses, and a tag written in a python string was read as markup, so H025, H054 and T001 reported findings inside these blocks. A <%def> body is markup and is still formatted and linted.H037 no longer reads an unquoted attribute value as an attribute name, so <img width=1 height=1> is not reported as a duplicate 1. This started in 1.45.0, and a real duplicate whose values are unquoted and start with /, . or #, as in href=/a href=/b, is now caught too.A space beside a template block is kept where the line break next to it is one a {%- or -%} marker strips. The break normally renders the space itself
{%- or -%} marker strips. The break normally renders the space itself, so djLint drops the space as redundant, but a stripped break renders nothing: {%- if args -%}, {% endif %} followed by {%- for %} lost the space between a macro's arguments.H037 no longer reads a quoted string inside a template tag as an attribute name, so href="{{ url "/a/b" "/a/c" }}" is not reported as a duplicate a. T
H037 no longer reads a quoted string inside a template tag as an attribute name, so href="{{ url "/a/b" "/a/c" }}" is not reported as a duplicate a. This started in 1.45.0.) }} to the start of the line.{{ function([nested(...)]) }} is no longer dedented by one level.{%- endif %}:</b>, keeps its own level instead of being indented one further.data-x='{{ f({ ... }) }}' no longer loses a space from every line.--single-attribute-per-line reaches attributes guarded by a template tag, so {% if x %} a="1" b="2" {% endif %} inside a tag no longer keeps them on one line past --max-line-length.--max-line-length is spread over several lines, where before only --max-attribute-length decided. A line long because of its text is left alone, since breaking text would change what renders.<{{ tag }}>, is read as a tag. It was not recognised at all, so a template block among its attributes was pulled out of the tag and re-indented to the start of the line, and its attributes went unformatted and unchecked.New rule H043 reports a written without a type. A type written inside a template block, as in , counts.
H043 reports a <button> written without a type. A type written inside a template block, as in <button {% if a %}type="button"{% endif %}>, counts.H044 reports a header row holding both th and td cells. The empty td that opens a two-axis table's header row is allowed.H045 reports an <iframe> with no accessible name. title, aria-label and aria-labelledby all count, as does a name written by a template tag.H046 reports a positive tabindex. 0 and -1 are left alone, as is a value written by a template tag.H047 reports aria-hidden="true" on an element that takes focus. Hiding a decorative icon is not reported, nor is a disabled control or one with tabindex="-1".H048 reports an aria- attribute that ARIA does not define, such as a misspelled aria-lable. Framework bindings like :aria-label are left alone.H049 reports a viewport that stops the page being zoomed, by user-scalable=no or a maximum-scale below 2.H050 reports an element html no longer defines, such as <center>, <font>, <marquee> or <strike>. Only the opening tag is reported, and a custom element whose name merely starts with one, such as <font-picker>, is left alone.H051 reports a role ARIA does not define for markup, such as role="buton". The roles DPUB-ARIA and GRAPHICS-ARIA add count, abstract ones such as landmark do not, and a value written by a template tag or a framework binding such as :role is left alone.H052 reports a <meta http-equiv="refresh"> that reloads or redirects on a timer, which fails WCAG 2.2.1. A delay of zero is an immediate redirect rather than a timer and is not reported.--quote-style / quote_style sets the quotes djLint writes inside template tags, double (the default) or single, and T002 follows it, so {% include 'a.html' %} is no longer reported in a project that writes single quotes. Html attributes stay with H008.--sort-attributes / sort_attributes orders a tag's attributes by name, with id first and class second. A tag whose attributes are guarded by a template tag, as in <div {% if x %}a="1"{% endif %} b="2">, keeps the order it was written in.--name-endblocks / name_endblocks writes the block's name into the {% endblock %} that closes it, where the block spans several lines, making T003 fixable by running the formatter. A block opened and closed on one line is left alone.--no-indent-inner-html / no_indent_inner_html leaves <head> and <body> at the same indent as the <html> that holds them, matching the default VS Code html formatter.--keep-br-inline / keep_br_inline keeps <br> on the line of the text it breaks instead of giving it a line of its own. <hr> is unaffected, and the default is unchanged.--prefer-configuration lets the file named by --configuration override the project's own pyproject.toml or .djlintrc, which have always won where the two set the same thing. The default is unchanged.H008 asks, so <div class='a'> becomes <div class="a">. Only the names the rule reports are touched, and a value holding a double quote of its own keeps its single quotes.H010 reports are lowercased by the formatter, so <div CLASS="a"> is fixed rather than only reported. A name the rule does not know, such as an svg viewBox, keeps its case, and --ignore-case turns it off.© becomes ©, which is what H023 asks for. Entities that carry syntax or template meaning are left as written, as are <pre>, <textarea>, <script> and <style> bodies, and --no-entity-formatting turns it off.type that html5 already assumes is dropped, as H024 asks, so <script type="text/javascript"> becomes <script>, and the same for <style> and a stylesheet <link>. A type that means something, such as type="module", is kept.method is lowercased, so method="POST" becomes method="post", which is what H029 asks for. A tag written inside a template tag's string is left alone.H031 is gone: the keywords meta tag it asked for no longer affects ranking, and bing treats it as a spam signal.H035 is gone; H017 already covers meta.H036 reports only two uses of <br>: a run of two or more, and a break against the inside edge of a block element. Breaks that are part of the content, such as in a postal address, are left alone, and the rule is on by default.T002 is on by default, and --reformat now writes the quotes it asks for, rewriting tag arguments and conditions such as {% if x == 'a' %} to the --quote-style in force. A string already holding the quote it would be rewritten to is left alone.T028 is off by default: the whitespace it strips can be whitespace that renders, so alt="{%- if brand -%}Acme{%- endif -%} logo" comes out as Acmelogo. It stays available with --include=T028.H014 counts blank lines the way the formatter does, so --max-blank-lines 2 and --preserve-blank-lines no longer produce files the linter then rejects. A line holding only whitespace counts as blank, and the report points at the first blank line rather than the content line above it.H020 leaves alone an element whose empty form carries meaning, such as a blank <option> holding a select open.H023 no longer reports an entity for an invisible character, such as ‌, in named, decimal or hex form.--ignore-case applies to the linter as well as the formatter, so H009 and H010 stay quiet when it is set.--profile=all honours every profile's exclude list, so T028 no longer fires on django markup to recommend {%- if -%}, which django rejects.<p title="a<br>b"> is not reported: affects D004, J004, H006, H011, H013, H017, H018, H019, H020, H021, H022, H036 and H043.D004, H019 and H021 see attributes written after a template tag containing a >, so the inline style in <div {% if n > 5 %}id="a"{% endif %} style="color:red"> is checked.<script>, <style>, <pre> and <textarea>, which used to be skipped along with the body, so H024, D004, H008, H010, H011, H012 and H037 can see their attributes. Only the body is skipped now, and its contents are never read as markup.D018 and J018 no longer report a link that already uses a url tag, such as <a href="{% url 'profile' %}" data-src="lazy">; a value now has to look like a path. /static/ and /media/ assets are left to {% static %} rather than reported as routes.H005 reports <html lang="">, and its message asks for a non-empty lang.H005 and H007 ignore custom elements whose name starts with html, such as <html-midi-player>.H007 reports a missing doctype in a file that opens with something it does not recognise, such as an <?xml ... ?> declaration.H008 leaves single quoted values holding a double quote alone, such as title='{% translate "Delete" %}'. An attribute that merely ends in a known name, such as data-title, is no longer treated as that attribute.H009 reports exactly the elements the formatter lowercases, so --reformat always clears it: <IMG>, <INPUT> and <NAV> are now reported, and G, PATH, NAME and CACHE are not. An uppercase name inside an attribute value, as in <p title="x <DIV y">, is no longer read as a tag.H012 sees attributes written after a {{ ... }} in the same tag, so the spaced = in <div {{ attrs }} class = "x"> is reported.H013 accepts a valueless alt, so <img src="a.png" alt> passes as the decorative image alt="" already did.H016 recognises a <title> however it is written, so <title id='page-title'> no longer reads as a missing title and an svg <title> no longer counts as the document's. The report points at the <html> tag.H022 no longer reads an http:// inside another attribute's value as a link, and no longer reports loopback or private hosts: localhost, 127.0.0.1, 192.168.x, 10.x and .local or .test names.H024 covers <link rel="stylesheet" type="text/css">.H025 no longer calls a tag an orphan in a handlebars or go template: a wrapper opened in one branch of {{#if}}...{{else}}...{{/if}} and closed in the other is accepted, as in django and jinja.H029 reads only the form's own method attribute, so <form data-method="POST"> is not reported.H030 stays quiet for a base layout that fills its description in per page, so a head using {% block meta %} is no longer reported.H033 sees a form whose earlier attribute holds a >, as in <form x-show="count > 0" action=" /x/">.H037 counts an attribute written without a value, so <input required required> is reported as the duplicate it is.H042 leaves a label alone in a partial that holds no form control. A control that is commented out still counts, so the label above it is checked.T001 and T027 no longer read a delimiter inside a string as the end of the tag, so {{ x|default('}}') }} is reported neither as needing padding nor as holding an unclosed string. A string that really does run past the tag is still reported.T032 flags extra whitespace in tags that hold a |, (, ), :, ? or %, which were previously skipped. A run of spaces inside a string is still content and is left alone.T034 no longer flags a }% written inside a string, so {% trans "Save 50}% today" %} is left alone.T039 no longer reports a valid block tag holding a nested mapping such as {% set a = {"x": {"y": 1}} %}, a shape --reformat itself produces.T040 allows an empty literal that only feeds a filter, as in {% extends ""|default:"base.html" %}.<script>, <style> or <textarea> is left alone; var s = "<DIV CLASS=x>" is no longer rewritten to "<div CLASS=x>".H011 asks, so class=one becomes class="one". A value carrying a quote of its own, such as a=b'c, is still left alone.{% set %} or a function call keep their own quotes when they hold the other kind, so {% set s = 'say "hi"' %} is left as written instead of escaped.{{ }} stay where they are; the first is no longer pulled up against the opening bracket.{{ _("test")|upper }} keeps its shape.{{#if}} are no longer taken for the start of a Jinja comment, which left everything up to the next #} unformatted.+ whitespace control marker is read wherever - is, so {%+ if x %} counts as a block tag, T038 no longer misreports these blocks and the formatter indents them.{% that opens nothing no longer hides the markup after it: a page quoting template syntax in prose, as in <code>{%-</code>, is formatted rather than skipped down to the next %}.{% written inside javascript is no longer read as a template tag; a <script> holding '{%' and '%}' in its code used to leave its whole line unformatted.{% language 'de' %}text{% endlanguage %}, are recognised as balanced on a line too.<input id="a" type="checkbox"> used to flip between spread and joined on every run.<script> or <style> is followed by text. Text sitting directly against the element, as in a<script>x</script>b, is still left alone, since a line break there would render as a space.<script>, <style> or <pre>, so the children of <a class="x">text<style> now sit inside it, and a closing tag written after the block's end tag gives back the level it took.<pre>, <textarea>, <script> or <style> opened and closed on one line no longer cancels a block opened earlier: <pre>x</pre><script> left the script's body indented as markup, and took a second run to settle.<pre> and <textarea> that looks like a djLint marker, such as {# djlint:on #} shown as sample code, no longer ends the verbatim block and walks its contents a level further right on every run.--preserve-leading-space no longer moves a line further right on every run, as it did for a multi-line {# ... #} comment and every other line inside an indented block.--preserve-leading-space no longer keeps a blank line on one run and drops it on the next when a <pre> or <textarea> is written with leading indentation; --blank-line-after-tag had the same drift from the second tag in its list onwards.--preserve-leading-space, the contents of a {{ if }} or {{ range }} block no longer lose an indent level when an already formatted go template is formatted again.--blank-line-before-tag no longer splits a line to place its blank line, so a tag written after other content, such as the {% block %} inside a one line {% set %}...{% endset %}, stays where it is.--blank-line-before-tag no longer inserts a blank line into an attribute value, which grew the file on every run. --blank-line-after-tag already left attributes alone.djlint:off block placed between a tag's attributes no longer crashes the formatter when it contains a backslash, and its text comes back exactly as written.--format-css and --format-js no longer indent a <style> or <script> body by the wrong amount when several files are formatted at once.djlint - --reformat --lint no longer writes its report into the file: the lint findings, the --statistics block and the --github-output annotations go to stderr when stdout is carrying the formatted code. A lint-only run is unchanged.--github-output annotations no longer land in the file either: in CI, where the flag turns itself on from $GITHUB_ACTIONS, cat f.html | djlint - --reformat > f.html wrote ::warning lines into f.html.--statistics prints its summary alongside GitHub annotations. It was dropped whenever the GitHub output was on, which happens by itself in a workflow.djlint -: a CRLF buffer piped to --reformat came back LF throughout. Input that --require-pragma skips is handed back byte for byte.<script> string was rewritten as a newline and broke the script.\U0001f622 rather than an emoji.djlint . | head -1, is no longer a failure: it printed a traceback and exited 120.djlint . templates/, is checked once, so it is no longer reported and counted twice or written twice under --reformat.custom_blocks, ignore_blocks, custom_html, blank_line_after_tag or blank_line_before_tag, as in ignore_blocks = "raw,", is ignored instead of turning off template indentation altogether or padding every template tag in the file..gitignore is read only when --use-gitignore or use_gitignore asks for it, so a line djLint cannot parse, such as one ending in a backslash, no longer aborts every run in the project with a traceback.--require-pragma skips a file whose first line it cannot decode instead of aborting the whole run. A file that is checked and turns out undecodable is still reported as a failure.--indent-js and --indent-css override the indent alone, leaving other beautifier settings in the config file's js or css block, such as wrap_line_length, in place.--ignore and --include accept a space after the comma, so --ignore "H011, H013" no longer reports H013.H026 page no longer claims an empty class or id cannot be targeted: an attribute presence selector such as div[class] does match one, so removing the attribute can change how a page is styled.--github-output / --no-github-output override that.--allow-empty-input appears in the command line reference, which had been missing it.H042 is no longer documented as off by default, which it stopped being in 1.42.1.T002 is on by default.H037 no longer reports two attributes whose names differ only before a . as duplicates (data-a.checked and data-b.checked, or alpine's x-on:click.prev
H037 no longer reports two attributes whose names differ only before a . as duplicates (data-a.checked and data-b.checked, or alpine's x-on:click.prevent and x-on:keyup.prevent).data-alt and data-x.alt left H013 silent on an image with no alt, data-lang and xml:lang silenced H005, data-height and data-width silenced H006, data-name="description" silenced H030 and data-name="keywords" silenced H031, and data-x.id satisfied a <label for> for H042.title="alt=x" left H013 silent, class="language-en" silenced H005, and title="the ID=5" was reported by H010 as an uppercase attribute name.H005 no longer reports a tag whose name only starts with html, such as <htmlx>, and points at the <html> tag itself rather than at everything up to the last > in the file.Formatting no longer changes what the page renders. A space that shows was dropped ( a b rendered as ab, a{% if x %} b {% endif %}c as abc), a space t
<span>a</span><span> b </span> rendered as ab, a{% if x %} b {% endif %}c as abc), a space that shows nothing was added (<span> </span> became <span> </span>), and moving a tag onto its own line could add one (x<img>y, or across a comment as in a{# c #}<img>). Whitespace is now kept where it renders and dropped where it does not.title tooltip no longer loses a line and a data- value read by script no longer comes back different. Line breaks in class, style, srcset and sizes mean nothing and are still joined.<pre> and <textarea> is left alone when the closing tag has something after it on its line (<pre> a\n b</pre> tail).</b><i>) indents its contents again, and a line that closes more tags than it opens unindents even when a whole tag ends it (</b><small></small>). Both left the lines after them at the wrong level.--line-break-after-multiline-tag now applies only to tags actually written over several lines, as its help says. It was holding back the content of every element, splitting tags that fit on one line.class value is tidied wherever it was written: class=" a b " becomes class="a b". A tag whose attribute value holds a line break is spread over lines, since it cannot fit on one.New --allow-empty-input option, and the matching allow_empty_input config key, exits 0 instead of 2 when the given paths match no files.
--allow-empty-input option, and the matching allow_empty_input config key, exits 0 instead of 2 when the given paths match no files.{% if %}...{% endif %} no longer dedents everything that follows it by one level, collapsing nested structures toward column 0 - a regression in 1.43.0. A close tag already at the content level of the template block it sits in is held there, but the level it was denied was then taken off the end of the line instead, so {% if r %}</strong>{% endif %} moved the rest of the block left. The matching open tag never took a level to give back, since {% endif %} had already returned it.exclude, extend_exclude, use_gitignore or require_pragma now exits 0 instead of 1. Skipping them is the configuration doing its job, and it is what lets exclude work under pre-commit, which passes the names of every staged file. Paths that match no files at all now exit 2 rather than 1, so exit 1 means only that djLint found something to report.2 instead of 1, so a crash is no longer indistinguishable from a lint error. The traceback is still printed.--profile, or profile in a config file, is now a usage error. A typo used to lint with a silently different rule set and exit 0, and raised KeyError with --require-pragma.build.html/) is no longer picked up as a template and opened as a file, crashing the run.No files to check! is written to stderr instead of stdout, where formatted code is written.djlint - --reformat that --require-pragma skips is handed back byte for byte instead of being replaced by No files to check!.blank_line_before_tag no longer inserts a blank line when the previous line opens a block and increases the indentation, e.g. between and {% block %}.
blank_line_before_tag no longer inserts a blank line when the previous line opens a block and increases the indentation, e.g. between <div> and {% block %}. Since 1.41.0 blank_line_after_tag has left the closing edge of a block alone ({% endblock %} before </div>), while the opening edge kept its padding, so a template using both options came out lopsided.H025 no longer reports the closing tag of a multi-line or as an orphan - a regression in 1.43.0. A genuinely unmatched is still reported.
H025 no longer reports the closing tag of a multi-line <script> or <style> as an orphan - a regression in 1.43.0. A genuinely unmatched </script> is still reported.New --stdin-filename option gives content piped in on stdin (djlint -) its real path, so per-file-ignores matches against that name and linter message
--stdin-filename option gives content piped in on stdin (djlint -) its real path, so per-file-ignores matches against that name and linter messages report it. Per-file ignores were previously dead for piped input, since nothing matches the name -. Path separators are normalized as they are for files on disk.title="{% translate "You don't have permission" %}") no longer swallows the rest of the document, which made H025 report every enclosing element as an orphan. A template tag in a value is now skipped whole unless it holds a >, so a quoted literal like a="{{" is still left alone.</span>tail<textarea>y</textarea>) unindents again; everything after it stayed one level too deep.{% endif %} <td class="x">y</td>) indents as a block tag again, so {% endif %} unindents and {% else %} aligns with its {% if %}. A line only takes that shape once the tag fits on one line, so reformatting an already formatted file moved it.</pre> <span>x) is tracked again; its closing tag took a level from a tag opened before the block, dedenting that tag's siblings.<div>{% if x %}), and the choice is no longer applied to the wrong block. Blocks were paired with the source by position, which does not line up with the expanded html; they are now matched by tag and contents.style, srcset, data-srcset or sizes value was written over several lines is no longer spread over multiple lines and pulled back together on the next run. max_attribute_length is now measured against what is written out, not against padding that the rewrite drops.<pre> or <textarea> opened on a line that also holds a self-contained comment (<pre>x<!--c-->) is recognized as opening a verbatim block again. Its contents were re-indented instead of left alone, and the closing </pre> gained an indent level on every run - unbounded whitespace growth inside preformatted text.text <b>bold / </b> tail). The loss accumulated, so a document repeating that shape drifted further left with each occurrence. A closing tag with nothing to pair against still dedents as before.< inside a one-line <script>, <style>, <textarea> or <title> no longer counts as a tag when indenting. <script>var a = '<span>'</script> left a phantom open <span> on the tag stack, leaving everything after it one level too deep.text <b>bold / more</b> tail inside a <p>) - a regression in 1.40.8. The wrong output was idempotent, so it survived later runs.{{/* ... */}} is no longer read as a block close tag. It starts with {{/, the handlebars block-close prefix, so it popped a block off the stack: H037 reported Duplicate attribute found. for mutually exclusive attributes such as <a {{if .A}}href="a"{{else}}{{/* c */}}href="b"{{end}}>, and the formatter unindented the rest of the block. A comment renders as nothing, so H037 no longer treats one as a template-generated attribute name prefix either.{% if x %}{# comment #} - was skipped by the linter, most visibly making T038 report End tag has no matching block tag for a balanced {% if %}. Affects every rule that skips ignored blocks (H025, H037, H041, H042, T002, T003, T027, T038, T039) and every kind of ignored block.djlint:off pragma no longer ignores the tag written immediately before it. <img>{# djlint:off #} silently dropped every error on that <img>, while <img>{# djlint:off H013 #} correctly reported it - a pragma covers what follows it, not what precedes it.Attribute names containing punctuation beyond -, ., :, @ and * no longer stop a tag from being wrapped over multiple lines. The attribute parser now a
-, ., :, @ and * no longer stop a tag from being wrapped over multiple lines. The attribute parser now accepts any character HTML allows in an attribute name, so Alpine key modifiers (@keydown.prevent.?), Angular bindings ((click), [disabled]) and Vue shorthands (#slot) are formatted like every other attribute instead of leaving the whole tag on one long line. Angular bindings also reach --format-attribute-js-json for the first time, which already listed them.src={{ MEDIA_URL }}/logo.png, href={{ .Permalink }}#{{ .Anchor }}) is no longer split into a truncated value plus a bogus standalone attribute when attributes are wrapped; it stays one value, quoted when spread.Attributes containing ${...} inside a quoted value (e.g. JS template literals like `:name="x[${i}]") respect max_attribute_length again and are spread
${...} inside a quoted value (e.g. JS template literals like :name="`x[${i}]`") respect max_attribute_length again and are spread over multiple lines - a regression in 1.40.6. Unquoted Mako-style ${...} expressions in tags are still left unformatted.<!-- that is not a real HTML comment (for example inside a {# ... #} template comment or inside a <textarea>/<pre>) no longer swallows the rest of the document. This fixes false H025 orphan-tag reports and over-indentation of the tags that follow - a regression in 1.40.6.{{{ ... }}} and raw-block {{{{ ... }}}} expressions used as tag attributes are tokenized correctly again, fixing false H025 orphan-tag reports - a regression in 1.40.6.data-x="{{") no longer makes the tokenizer scan into later content looking for a matching }}, which could collapse <pre>/<textarea> whitespace - a regression in 1.40.6.}} of a handlebars {{#if}}/{{#each}} block-open tag is now idempotent; it no longer leaks a trailing space into the following {{...}} tag on later formatting passes.T038 no longer reports block tags that appear only inside a handlebars comment ({{!-- ... --}}, {{! ... }}) or inside a handlebars raw block ({{{{raw}}}} ... {{{{/raw}}}}).T039 no longer reports handlebars raw-block delimiters ({{{{raw}}}} / {{{{/raw}}}}) as unclosed template tags.< or dangling =) are now left untouched instead of having the unparsable characters silently dropped when attributes are wrapped.< used as a less-than operator inside a template expression in text or <script> content (e.g. ${a<b}, {{a<b}}) is no longer mistaken for an HTML tag start, which could merge or drop following content and break idempotency - a regression in 1.40.6.: or / (e.g. href=https://example.com/page) are no longer split into a truncated value plus a bogus standalone attribute when attributes are wrapped - a regression in 1.40.6.="value" attribute is no longer rewritten with the literal attribute name None; malformed attributes are left untouched.<textarea>/<pre> is preserved instead of being collapsed by whitespace cleanup (it is verbatim content).{% comment %}, {% blocktrans %}, {% filter %}, <pre>, <script>, etc.) is dramatically faster on templates with many {% ... %} tags. A lazy [ ]*? before the block keywords caused pathological backtracking; the equivalent greedy [ ]* removes it, cutting reformat time on large template-heavy files by roughly 5x.H017 and H018 no longer style command, keygen and menuitem - elements that were removed from the HTML standard.
command, keygen and menuitem - elements that were removed from the HTML standard.Linter rule defaults were reviewed against a simple bar: on by default means correctness, security, clear accessibility, or a consistency check the formatter also enforces - with near-zero false positives. Four rules moved to opt-in (--include=...):
{% endblock %}; the name demand is a style preference. The correctness checks T003 used to bundle - unclosed {% block %}, orphan {% endblock %} and mismatched endblock names, all hard template errors - moved into T038, which stays on by default, so nothing real is lost when T003 is off.aspect-ratio, preventing layout shift) but performance rather than correctness, and the dimensions are frequently unknowable in a template - user uploads, CMS urls, art-directed <picture> sources - so the rule demands data the author may not have.--include=H031.{{ ... }} output (form widgets), {% include %}/{% extends %} or unrecognized template tag silences the rule for that file, so where it does run, every report is a genuinely broken label association (a WCAG 1.3.1/4.1.2 failure the W3C validator also treats as an error).New askama profile for Askama (jinja-style templates in Rust). Rust expressions are never reformatted: function and {% set %}/{% let %} formatting are
Template languages:
askama profile for Askama (jinja-style templates in Rust). Rust expressions are never reformatted: function and {% set %}/{% let %} formatting are disabled so some_macro!("foo")?, char literals 'a' and tuples keep their exact spelling, and string quotes are never rewritten. The Flask-specific url_for rules (J004/J018) don't apply.tera profile for Tera (Rust, used by Zola): jinja-style formatting plus Tera v2 {% component %}/{% endcomponent %} blocks and single-tag {% set_global %}. The Flask-specific url_for rules don't apply. MiniJinja needs no profile of its own - it is fully Jinja2-compatible, use --profile=jinja.liquid profile for Liquid (Shopify themes, Jekyll, Eleventy, the Rust liquid crate). {% case %}/{% when %}, {% capture %}, {% tablerow %}, {% form %}, {% paginate %}, {% highlight %} and {% unless %}/{% elsif %} indent correctly, {%- -%} whitespace control is handled, and the bodies of Shopify section tags ({% schema %}, {% style %}, {% javascript %}, {% stylesheet %}) are left untouched - they contain JSON, CSS or JS rather than html.golang profile now indents template blocks: {{ if }}, {{ range }}, {{ with }}, {{ block }} and {{ define }} indent their contents up to the matching {{ end }}, with {{ else }}/{{ else if }} as branches and the {{- -}} whitespace-control forms included. Blocks opened and closed on one line are left alone; single tags like {{ template }} and lookalike variables such as {{ .end }} are unaffected.New linter rules:
{% extends %} or {% include %} with a missing or empty template name - an error the engine only raises at render time, so the typo is easy to ship.{% block %} and closed in a different one. The pair looks balanced in the file, but a child template overriding either block renders unbalanced html.--include=H018): void tags closed with /> instead of >, e.g. <br/> - the trailing slash has no effect in HTML. The opposite convention of the optional H017 ("void tags should be self closing"); enable one or the other, not both.--include=H042): a <label for="..."> whose value matches no element id in the same file. Template-generated values are skipped; the rule is opt-in because inputs rendered by e.g. {{ form.email }} carry ids the linter cannot see.Configuration:
indent and max_line_length now fall back to indent_size and max_line_length from a .editorconfig at the project root. The command line and djlint config files still take precedence, and only sections applying to html (or the configured extension) are read.Documentation:
<cola> (matched by a broken colgroup exclusion) and custom elements like <img-icon> are no longer reported. <meta> tags, missing from the rule's void tag list, are now reported.New rule T038: block template tags with no matching end tag are now reported: {% if %} without {% endif %}, handlebars {{#if}} without {{/if}}, end ta
{% if %} without {% endif %}, handlebars {{#if}} without {{/if}}, end tags with no opening tag, and crossed blocks like {% if %}{% for %}{% endif %}. Tags from custom_blocks are checked too; {% block %}/{% endblock %} pairs stay covered by T003.{% url 'x" user.url }} (closed by }} instead of %}), {{ user.name } (missing a brace), or a tag cut off by the next tag or the end of the file. Complements T027 (unclosed string in a complete tag) and T034 (}% typo), which keep reporting their own cases.--rules FILE CLI option: load a custom rules file in .djlint_rules.yaml format from any path, instead of only next to pyproject.toml.{% if abc == 101 %} becomes {% if abc == 101 %}. This fixes what rule T032 reports, so the linter and formatter no longer conflict. Whitespace inside string literals is preserved, including strings with backslash-escaped quotes; multiline tags, ignored blocks, the literal contents of {% verbatim %}/{% raw %} and the handlebars/golang profiles are untouched.exclude list is now tailored to djLint instead of copying ruff/black. Added directories that hold generated or third-party HTML: htmlcov (coverage.py reports), site-packages (installed packages' templates such as Django admin and DRF, matched in any virtualenv layout) and _site (Jekyll/Eleventy output). Removed Python tool caches and editor config that never contain HTML: .ipynb_checkpoints, .mypy_cache, .pytest_cache, .pytype, .ruff_cache, .pants.d, .vscode and buck-out.Formatter indentation:
<div> rendered by {% if %}...{% endif %} and closed by a later conditional) no longer shift the indentation of everything after it. When every branch of an {% if %}/{% elif %}/{% else %} shifts the depth equally, e.g. a <tr> opened in both branches, the shift is kept after {% endif %}.{% story ... with { ... } %}, {% include ... with { ... } %} and non-JSON {{ func(...) }} calls are now indented by bracket depth.{% endtrans %} (Jinja/Twig block {% trans %}) no longer decreases the indentation level, which shifted the {% endtrans %} line and everything after it one level to the left.{% set %} objects nested inside HTML elements are no longer over-indented in proportion to their nesting depth.{% component "calendar" date="2015-06-19" / %} with custom_blocks = "component") no longer indent the lines that follow them as if a block had been opened.Formatter line breaks and spacing:
{% set x %}...{% endset %} is no longer expanded onto multiple lines. The block captures its content verbatim, so the added whitespace changed the value of the variable. Authored multi-line set blocks are still indented as before.{{ ... }} function calls, a call passed as an argument no longer causes a stray space before the following comma, and the arguments after it keep the same indentation as the other arguments.blank_line_after_tag no longer inserts a blank line when the next line closes a block and decreases the indentation, e.g. between {% endblock %} and </div>.blank_line_before_tag now inserts the blank line above a comment directly preceding the tag, keeping the comment attached to the tag it documents.Linter:
<slot></slot>: an empty slot element is the standard way to declare a default slot outlet.{% if %}/{% else %} and closed once outside it (and vice versa for close tags), since only one branch renders.<b> in <h1>blah <b>bold</h1>.{% endblock %} is on the same line as its {% block ... %}, e.g. {% block title %}{% endblock %}. The formatter keeps such blocks on one line, so the linter and formatter no longer conflict.{% verbatim %}...{% endverbatim %} blocks, matching the existing treatment of jinja {% raw %} blocks.Configuration:
ignore, include, custom_blocks, custom_html, exclude, extend_exclude, ignore_blocks, blank_line_after_tag, blank_line_before_tag) can now also be given as lists, e.g. ignore = ["H017", "H031"] in pyproject.toml; previously list values were silently ignored.--max-blank-lines given on the command line is no longer overridden by the config file, matching all other options.Fix crashes in mypyc-compiled wheels: AttributeError: attribute 'reformat' of 'Config' objects is not writable when linting or formatting multiple fil
AttributeError: attribute 'reformat' of 'Config' objects is not writable when linting or formatting multiple files, and AttributeError: attribute 'start' of 'TagToken' objects is not writable when processing a file.Indent content inside Django {% cache %}, {% timezone %}, {% localtime %} and {% localize %} blocks instead of dedenting everything after them.
{% cache %}, {% timezone %}, {% localtime %} and {% localize %} blocks instead of dedenting everything after them.<c-card> and <c-forms.input /> as block HTML tags without requiring custom_html configuration.<b>bold</b><span> </span><i>italic</i> keep rendering a space; non-collapsible whitespace such as U+2005 is kept verbatim._ attribute values, where a newline separates commands and -- comments run to the end of the line.class and style values are spread over multiple lines with format_attribute_template_tags.{% comment %} block content untouched when reformatting, e.g. bare URLs ending in />.djlint:off RULE suppression to any finding overlapping the region, so reformatted guards keep linting clean.{% if x %}data-{% endif %}srcset.Preserve conditional attribute names and significant whitespace in template-generated attributes.
id or class is followed by a spaced equals sign.embed blocks.exclude and extend_exclude for explicitly provided files.Preserve URLs enclosed in angle brackets inside template comments.
Replace repeated HTML regex scans with tokenization.
Avoid false H037 reports when attribute names appear inside quoted values or other attribute names.
Keep Jinja comments and set tags idempotently indented with preserve_leading_space.
preserve_leading_space.id appears inside quoted attribute values.action parameters inside quoted template URL helper attributes.blank_line_after_tag from inserting blank lines inside multiline HTML attribute values, preserving idempotent reformatting for embedded template tags.{% endblock name %} does not match its opening {% block name %}.<p> tags.Preserve djlint:off blocks inside tag attributes and avoid false H025 orphan reports when a matching tag crosses a djlint:off block boundary.
djlint:off blocks inside tag attributes and avoid false H025 orphan reports when a matching tag crosses a djlint:off block boundary.{% if %} blocks idempotent after one reformat pass.Keep multiline inline-tag indentation when an inline child appears before following text.
Preserve full djlint:off blocks before formatter passes so ignored template, script, and style content is not rewritten.
djlint:off blocks before formatter passes so ignored template, script, and style content is not rewritten.filter blocks instead of moving punctuation or translated text around them.<textarea> closing tags aligned without reformatting untrimmed textarea contents.Add single_attribute_per_line to wrap attributes in a Prettier-like layout using the configured indent.
single_attribute_per_line to wrap attributes in a Prettier-like layout using the configured indent.Preserve Jinja template comments inside formatted and blocks.
<script> and <style> blocks.Avoid false H025 reports for HTML-like strings inside template tags.
<script> and <style> blocks.Return 1 when no files match the requested lint or format run.
--check - return 1 when formatting changes are needed.Fix crashes in mypyc-compiled wheels.
Use Click instead of tqdm for progress output, send progress to stderr, respect --quiet, and honor NO_COLOR. Remove direct colorama and tqdm dependenc
--quiet, and honor NO_COLOR. Remove direct colorama and tqdm dependencies now that Click handles CLI colors and progress.blank_line_after_tag and blank_line_before_tag.v1.39.1 was not published due to mypyc compilation error.
v1.39.1 was not published due to mypyc compilation error.
Add preserve_class_newlines / --preserve-class-newlines to keep authored line breaks inside multiline class attributes. #495
preserve_class_newlines / --preserve-class-newlines to keep authored line breaks inside multiline class attributes. #495{% partialdef %} block indentation so {% endpartialdef %} aligns with its opener. #1556max_line_length.Fix python -m djlint not working due to mypyc compilation.
python -m djlint not working due to mypyc compilation.python -m djlint not working due to mypyc compilation.One column per quarter.