Aller au contenu

Changelog

Ce contenu n’est pas encore disponible dans votre langue.

  • The npm package no longer runs pip on whatever python3 it finds. It comes with its own Python and djLint, so it needs only Node.js 16.9 or newer, and works under pnpm and Bun, which skip the install scripts of dependencies. npm installs the build for the platform: Linux on x64, Arm64, ppc64le, s390x or riscv64 (with musl, on x64 or Arm64), macOS on x64 or Arm64, or Windows on x64, x86 or Arm64. Where PyPI has wheels of djLint compiled with mypyc, the build has the same one; on Linux for ppc64le, s390x and riscv64 djLint is pure Python.
  • H042 no longer reports a <label for> that points at a <textarea>. When it looked for ids, it skipped every <textarea>, <script>, <style> and <pre> element whole, opening tag included, so an id written on one never counted.
  • The linter no longer skips what follows a custom element whose name starts with that of a raw text element, such as <preview-card> or <script-x>. It used to read one as a <pre> or <script> that runs on to the next </pre> or </script>, or to the end of the file.
  • The language server picks the profile from more of the language names editors use: twig (Neovim, Helix, Emacs) gets nunjucks, htmlangular (Neovim) gets angular, and the names VS Code extensions give HubL, Spacebars, Mustache, Liquid and Go templates get the profile of their language.
  • Each item of an exclude or extend_exclude list in the config file is one regex, whatever it holds, so a comma in it needs no \, and an unclosed { no longer joins the next item to it.
  • In a comma-separated exclude or extend_exclude, a {, [ or \ inside a # comment no longer hides the entries after the comment.
  • An empty exclude or extend_exclude, or an entry in one that holds only a comment, no longer excludes every file inside a folder. Each regex is checked on its own, so a trailing backslash in one is reported instead of swallowing the next.
  • A comma inside an exclude or extend_exclude regex, as in report[0-9]{1,2}\.html or [,;], stays part of it. Such a regex used to be cut in two at the comma and match nothing, also when written in a list in the config file. A comma meant literally is written \,.
  • A <!-- djlint:off --> written right before its <!-- djlint:on -->, with nothing between them, no longer hides the rest of the file from the linter.
  • A .editorconfig djLint isn’t allowed to read is left out, as editors leave it out, instead of stopping the run with a traceback.

This version never reached PyPI or npm: its release build failed. 1.52.2 carries its fixes.

  • A pattern in exclude, extend_exclude or per-file-ignores that isn’t a valid regular expression, such as the shell glob *.min.html, is an error naming the setting, with the regular expression to write instead. It used to stop the run with a traceback. A # comment at the end of an exclude or extend_exclude entry no longer hides the entries after it.
  • The djlint-handlebars and djlint-reformat-handlebars pre-commit hooks check .handlebars and .mustache files as well as .hbs, in any case, and the Liquid hooks check .liquid files as well as .html. They used to skip them.
  • New rule D058 reports a Django tag or comment that spans lines, such as a {# #} comment written over several lines or an {% include %} whose arguments go on to the next line. Django reads a tag only within one line, so it prints these as text, and an {% if %} split that way stops the template from compiling. Anything inside a {% comment %} or {% verbatim %} block is left alone, and so is a {% or {{ that another tag follows before its closing, which T039 reports.
  • New rule D059, off by default, reports consecutive lines that each hold only a {# #} comment, which a {% comment %} block holds as one. A djlint: directive and a translator comment never join such a run, and comments inside <pre> and <textarea> are left alone, since the line breaks they leave show on the page there.
  • djLint warns about a djLint file that sits beside the one it reads and so isn’t read, such as a djlint.toml next to [tool.djlint] in pyproject.toml, or a .djlintrc next to a djlint.toml.
  • .editorconfig files are read as editors read them, for each file by its own path: the nearest .editorconfig wins, the ones above it fill in what it leaves out, and one with root = true ends the search, which goes no higher than the project root. Sections match by the EditorConfig globs, paths included, so [pages/*.html] sets only the templates in pages, and unset drops a value that a file above gives. Only the project root’s .editorconfig was read, and its settings went to every file of the run.
  • A switch in a configuration file takes true or false again, nothing else. 1.51.0 also read "yes", "on", "1" and other words for one, which is now an error naming the file. The text "true" or "false" still works, with a warning to write it without quotes, and so does a number written as text, such as "100".
  • The warning about a code in include that never runs no longer names the html profile when none is set. It says the rule never runs without a profile, where the linter follows html.
  • A pyproject.toml without djLint settings no longer stops the search for the configuration, so a package in a monorepo with its own pyproject.toml gets the settings of the repository instead of none. The search still stops at a folder with a djlint.toml, .djlint.toml, .djlintrc, .djlint_rules.yaml or a pyproject.toml with [tool.djlint], and never goes past the root of the repository (.git or .hg).
  • djLint warns about settings that would not do what they look like, so a typo no longer goes unnoticed. The warnings go to stderr once per run, as the others do:
    • a name in a configuration file that is not a djLint setting, with the closest one it knows, as max_line_length for max_line_lenght or max-line-length;
    • a rule code in ignore, include or per-file-ignores that no rule has, with the right case for h006; a code in both ignore and include, which stays off; and a code in include that the profile never runs, such as T028 under django;
    • --indent-css or the css settings without format_css, the same for JavaScript, and format_attribute_js_json_pattern or format_attribute_js_json_min_props without format_attribute_js_json.
  • The language server shows these warnings in the editor, each once until the configuration changes, and so does a setting the editor sends that djLint doesn’t know, with the closest one it does. The editor’s ones used to go only to the server’s log.
  • djlint.api.load_config takes on_warning, a function that gets every warning about the settings, for a program that shows them itself. Without it, they go to stderr once per process, as before.
  • A switch in a configuration file can also be written as the words configparser takes, in any case: "yes", "on", "true" or "1" for on, "no", "off", "false" or "0" for off, and the numbers 1 and 0.
  • The text "false" in a configuration file turns a switch off. Any text used to turn it on, so "format_css": "false" formatted CSS. A value that is no switch, such as "maybe", is now an error naming the file, as a number setting that is no number already was.
  • A number setting written as true or with a fraction, such as indent = true or max_line_length = 100.5, is an error. They used to become 1 and 100. A whole number written with a fraction part, 100.0, still counts.
  • A linter_output_format naming a field djLint doesn’t have, such as {lin}, is reported when the run starts, with the fields it can name. The run used to fail at the first finding.
  • per-file-ignores takes a list of codes for a pattern, as the other options with several values do, such as "base.html" = ["H030", "H025"]. A list used to make linting fail.
  • 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.
  • Without a profile, the linter runs the same rules as under --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 with the rules of html.
  • 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, such as a warning jsbeautifier emits or missing wheels for Python 3.11, rather than anything djLint needs:
    • jsbeautifier from 1.14.10 back to 1.13.0
    • pathspec from 0.10.0 back to 0.9.0
    • pyyaml from 6.0 back to 5.1
    • regex from 2022.9.11 to 2020.10.22
  • Raise the minimum required dependency versions to ones that work on Python 3.11, djLint’s oldest supported version:
    • jsbeautifier from 1.13.0 to 1.14.10. Older releases have an invalid escape sequence, which Python 3.12 and newer warn about the first time djLint formats JavaScript.
    • pathspec from 0.9.0 to 0.10.0. Older releases accept an invalid .gitignore line such as build\ without an error.
    • pyyaml from 5.1 to 6.0 and regex from 2021.8.21 to 2022.9.11, the first releases with wheels for Python 3.11.
  • The npm package has the same description as the one on PyPI, which lists the template languages. PyPI links the changelog and the issue tracker, and both mention the language server in their keywords.
  • 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 only where in the file the problem was.
  • When the last line of a multiline template tag starts with a closing bracket, as in ]) }}, 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.
  • A template that is not valid UTF-8, or that djLint isn’t allowed to read or write, no longer aborts the run with a traceback and a request to report a bug. djLint names the file and the reason, checks the rest and still exits 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.
  • A configuration file djLint can’t read, such as a 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.
  • Ctrl+C exits 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.
  • Importing 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) }}, is kept as written. It was rewritten as a line break, which changed the string.
  • H057 reports a video whose only track has an empty 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.
  • The error about a number setting that is not a number names the file the value was read from, such as 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 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.
  • Twig’s {% apply %}, {% sandbox %} and {% guard %} blocks and Django’s old {% ifequal %} and {% ifnotequal %} blocks indent their contents like other blocks.
  • A number setting written in a config file as a list, a table or null, as 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.
  • An end tag that closes no open block, such as the end of a custom block djLint does not know, as in {% 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.
  • A string written as adjacent literals, as in {{ _("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.
  • A tag whose quoted value runs over thousands of lines, as when its closing quote is missing, no longer slows formatting down. Forty thousand such lines took over seven seconds and now take about one.
  • Text with many ${ 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-configuration without --configuration. The warning goes to stderr once per run, so the language server does not repeat it on every change.
  • A closing tag missing its >, 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 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 <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.
  • A <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.
  • With --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.
  • With --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.
  • The help and the docs for --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 second. Four hundred such lines took from 45 seconds to seven minutes. Linting such lines with T002 no longer slows down the same way.
  • A tag holding thousands of template tags written without spaces, as in <script {%a%}{%a%}…>, formats and lints in well under a second. It took tens of seconds.
  • Formatting a template a second time no longer changes it in the cases below, so djlint --check passes right after djlint --reformat.
  • An element or a template block is put on one line only when the whole line fits within --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.
  • A tag whose attributes fit within --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.
  • A {% 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.
  • An empty <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.
  • A tag written in a string inside a {{ }}, {% %} 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.
  • A template tag in an attribute value that holds the value’s own quote and an apostrophe, as in 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.
  • A stray quote in a tag, as in <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.
  • A > 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.
  • Text inside a template tag in an attribute value is left as written. The formatter collapsed the spaces in 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.
  • A tag with a single attribute is no longer spread over several lines because its line is longer than --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.
  • A tag with a style or srcset attribute that has no value no longer stops the formatter with an error when its attributes are spread over several lines.
  • A 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.
  • A call written on the line after {{, 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.
  • A template tag written across lines inside an attribute value keeps its layout, including the indentation of the line it closes on.
  • Whitespace inside a quoted string that spans lines in a template tag, as in {% 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.
  • A short template block written across lines stays that way also when it holds a string whose quotes the formatter rewrites, as in {% if x %} followed by {{ _('Deleted') }} on its own line. It used to be put on one line.
  • The formatter drops a 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 =.
  • A default 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.
  • A template comment written after the last attribute of a tag, as in <div class="x" {# note #}>, is kept. With a profile that has {# #} comments, the formatter deleted it.
  • An unquoted attribute value next to a template tag written with -, 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.
  • A template tag written against an attribute or against the tag name, as in <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 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 cost more than they saved.
  • The language server answers in about a third of the time when the editor sends its settings with every request, as the VS Code extension does, and its memory no longer grows over a long session.
  • Every run starts a little faster, unless it uses --use-gitignore.
  • A line of many inline tags before a block tag, which a stray quote such as "="" can leave in a template, no longer takes minutes to format.
  • A very large template no longer formats disproportionately slower than a small one: a 1.1 MB template formats in a third of the time.
  • 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 the answer arrives.
  • The language server keeps its settings when the editor sends a change of settings meant for other servers.
  • The language server sees changes of settings in editors that report them only to servers that ask, and reads the settings again when a workspace folder is added or removed.
  • 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.
  • The language server picks up a change of the configuration, or of a file named by configuration or rules, when a document is opened or saved, also in editors that don’t watch files, and updates every open document then.
  • The language server no longer stops on some malformed messages, and formats a document with old Mac line endings (CR only) without sending an edit past its end.
  • Linting a template with Windows line endings from stdin reports what the rules on blank lines find, as linting the file does.
  • A 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.api.is_excluded() tells whether the configuration leaves out a file.
  • With --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 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 positions. See Python API.
  • A finding now knows where it ends. --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.
  • A custom rule’s 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.
  • A 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.
  • A tag whose attributes are spread over several lines, but that doesn’t start its line, as in <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 <script> or in an attribute formatted with --format-attribute-js-json. It used to be dropped before the code was formatted.
  • The json schema allows any option under 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 %} 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.
  • The formatter drops the spaces 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.
  • Markup written inside an attribute value, as in <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.
  • The rules that read a tag’s attributes step over a template tag written in it, including a handlebars {{{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.
  • The rules that read a tag’s attributes stop at a stray <, 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.
  • Upload PEP 740 attestations to PyPI, so you can verify that the distributions were published from the GitHub Actions workflow of this repository.
  • 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 string argument, as in {% 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 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.
  • A > 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 %}.
  • A {# 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 to reach for. The page’s filter searches the versions too.
  • djLint publishes its own json schema at https://djlint.com/schema/djlint.json.
  • The minimum required regex version is lowered from 2022.6.2 back to 2021.8.21, the first release that ships wheels for Python 3.10, which is djLint’s own minimum.
  • 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 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 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.
  • New rule 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 %}.
  • New rule 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.
  • New rule 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.
  • New rule 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.
  • New rule 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.
  • New rule 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.
  • New rule 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.
  • New rule 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.
  • New rule 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.
  • New option --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.
  • A mako <% %> 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, 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. This started in 1.45.0.
  • A jinja call written over several lines keeps its closing bracket at the indent of the tag holding it, rather than pulling ) }} to the start of the line.
  • Arguments nested inside a jinja call written over several lines keep their depth, so the inner argument of {{ function([nested(...)]) }} is no longer dedented by one level.
  • An element after a line that closes both a template block and an html tag, as in {%- endif %}:</b>, keeps its own level instead of being indented one further.
  • A template tag written over several lines inside an attribute keeps the indentation the author gave it, so the body of 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.
  • A tag whose attributes push its line past --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.
  • A tag whose name a template writes, as in <{{ 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 <button> written without a type. A type written inside a template block, as in <button {% if a %}type="button"{% endif %}>, counts.
  • New rule 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.
  • New rule 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.
  • New rule H046 reports a positive tabindex. 0 and -1 are left alone, as is a value written by a template tag.
  • New rule 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".
  • New rule H048 reports an aria- attribute that ARIA does not define, such as a misspelled aria-lable. Framework bindings like :aria-label are left alone.
  • New rule H049 reports a viewport that stops the page being zoomed, by user-scalable=no or a maximum-scale below 2.
  • New rule 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.
  • New rule 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.
  • New rule 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.
  • New option --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.
  • New option --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.
  • New option --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.
  • New option --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.
  • New option --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.
  • New option --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.
  • Single quoted attribute values are rewritten to double quotes, as 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.
  • Attribute names that 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.
  • Formatting writes an entity reference as the character it names, so &copy; 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.
  • The 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.
  • A form’s 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 &zwnj;, 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.
  • A GitHub annotation names the column as well as the line, so it lands on the tag rather than the start of the line.
  • Markup inside an attribute value is no longer read as a tag, so <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.
  • Rules check the opening tag of <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" %}.
  • Markup written as text inside <script>, <style> or <textarea> is left alone; var s = "<DIV CLASS=x>" is no longer rewritten to "<div CLASS=x>".
  • An attribute value written without quotes is now quoted, as 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.
  • Strings inside a {% 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.
  • Arguments spread over their own lines inside {{ }} stay where they are; the first is no longer pulled up against the opening bracket.
  • Spacing is no longer added before a filter that follows a function call: {{ _("test")|upper }} keeps its shape.
  • Handlebars sections such as {{#if}} are no longer taken for the start of a Jinja comment, which left everything up to the next #} unformatted.
  • Jinja’s + 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.
  • A {% 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.
  • A template block opened and closed on one line no longer indents everything after it, and tags beyond the built in set, such as {% language 'de' %}text{% endlanguage %}, are recognised as balanced on a line too.
  • Extra spaces between attributes no longer count towards a tag’s length: <input id="a" type="checkbox"> used to flip between spread and joined on every run.
  • Formatting a file twice gives the same result when a <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.
  • Indentation is kept for an element opened on the same line as a <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.
  • A <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.
  • Text inside <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.
  • Repeated formatting with --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.
  • With --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.
  • A 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.
  • On free-threaded Python, --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.
  • Line endings survive djlint -: a CRLF buffer piped to --reformat came back LF throughout. Input that --require-pragma skips is handed back byte for byte.
  • U+2028, U+2029, U+0085, form feed and vertical tab are no longer treated as line breaks; one inside a <script> string was rewritten as a newline and broke the script.
  • Console output is utf-8 on stdout and stderr alike, so a warning no longer reaches a Windows console as \U0001f622 rather than an emoji.
  • Input on stdin that is not valid utf-8 is reported as bad input rather than as a djLint failure.
  • A closed pipe, as in djlint . | head -1, is no longer a failure: it printed a traceback and exited 120.
  • A file reached through more than one of the given paths, as in djlint . templates/, is checked once, so it is no longer reported and counted twice or written twice under --reformat.
  • A trailing or empty entry in 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.
  • Linting a large file is many times faster: a 120KB page went from 13 seconds to 0.15, and a 1.7MB run of 60 files from 28 seconds to 1.6. Linting a file with many findings is several times faster too.
  • Formatting is about a quarter faster, for around a tenth of a megabyte more memory: 575 templates from a large Django project took 2.6 seconds of processor time under 1.44.2 and take 1.9 now.
  • The 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.
  • The GitHub Actions integration is documented: djLint annotates a pull request’s diff with findings by itself, and --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.
  • The before-and-after example on the formatter page has been corrected: it showed a template tag with single quotes, which the formatter rewrites now that T002 is on by default.
  • Code samples on the site are highlighted in full again, after attribute names, punctuation and other tokens had lost their colours.
  • The playground tells a browser without web workers that it needs one, instead of failing first.
  • 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).
  • An attribute whose name merely ends in the name a rule looks for is no longer mistaken for it. 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.
  • A name written inside an attribute value is no longer read as an attribute. 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 (<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.
  • A line break inside an attribute value is kept, so a 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.
  • Indentation inside <pre> and <textarea> is left alone when the closing tag has something after it on its line (<pre> a\n b</pre> tail).
  • Whitespace css does not collapse, such as U+2005, is text, and is no longer stripped from the edges of an element or of the file.
  • Two indenting fixes: a line that closes one tag and opens another (</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.
  • A 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.
  • An html close tag inside an inline {% 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.
  • A run where every file found was skipped by 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.
  • An unhandled error exits 2 instead of 1, so a crash is no longer indistinguishable from a lint error. The traceback is still printed.
  • An unrecognized --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.
  • A directory whose name matches the file extension (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.
  • Input piped to 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 <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 <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 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.
  • An apostrophe inside a template tag nested in an attribute value (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.
  • A line that starts with a closing tag and ends with a whole tag (</span>tail<textarea>y</textarea>) unindents again; everything after it stayed one level too deep.
  • A template block tag followed by a whole html tag on the same line ({% 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.
  • A tag opened after the end of a verbatim block on the same line (</pre> <span>x) is tracked again; its closing tag took a level from a tag opened before the block, dedenting that tag’s siblings.
  • A template control block written across lines is kept that way when it opens against a tag (<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.
  • A tag whose 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.
  • A <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.
  • A closing tag that starts its line no longer dedents when the tag it closes was opened after text on an earlier line (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.
  • A < 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.
  • An inline element that opens after text on its line and closes on a later line no longer dedents everything that follows it by one level (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.
  • A Go template comment {{/* ... */}} 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.
  • A tag that merely touches an ignored block is no longer treated as being inside it. A tag ending exactly where an ignored block starts - such as {% 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.
  • A bare 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 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.
  • An unquoted attribute value with a template tag glued to the rest of the value (e.g. 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 over multiple lines - a regression in 1.40.6. Unquoted Mako-style ${...} expressions in tags are still left unformatted.
  • A stray <!-- 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.
  • Handlebars triple-stache {{{ ... }}} and raw-block {{{{ ... }}}} expressions used as tag attributes are tokenized correctly again, fixing false H025 orphan-tag reports - a regression in 1.40.6.
  • A quoted literal brace in an attribute value (e.g. 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.
  • Spacing the }} 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.
  • Malformed tag attributes that the attribute parser cannot fully parse (e.g. a stray < or dangling =) are now left untouched instead of having the unparsable characters silently dropped when attributes are wrapped.
  • A < 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.
  • Unquoted attribute values containing : 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.
  • A nameless ="value" attribute is no longer rewritten with the literal attribute name None; malformed attributes are left untouched.
  • Trailing whitespace inside an indented <textarea>/<pre> is preserved instead of being collapsed by whitespace cleanup (it is verbatim content).
  • Detecting ignored/verbatim blocks ({% 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.
  • Enabling H018 together with H017 or H035 now prints a warning when linting - they enforce opposite void tag conventions, so only one should be on.

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=...):

  • T003 (endblock names): neither Django nor Jinja requires a name on {% 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.
  • T002 (double quotes in tags): engines accept both quote styles, no autofix exists, and quote-style rules are the canonical example of style checks that don’t belong in a default tier.
  • H006 (img width/height): valuable performance advice (browsers map the attributes to a default 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.
  • H031 (meta keywords): major search engines have ignored keyword metadata for over a decade; recommending that it be added is outdated advice. The niche intranet-indexer use case keeps the rule available via --include=H031.
  • H042 (label/for) moved the other way - from opt-in to on by default - after its false-positive class was removed: the rule now checks a file only when nothing in it could render an id invisibly. Any {{ ... }} 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).

Template languages:

  • New 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.
  • New 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.
  • New 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.
  • The 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:

  • T040: {% 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.
  • H041: an html tag opened in one {% block %} and closed in a different one. The pair looks balanced in the file, but a child template overriding either block renders unbalanced html.
  • H018 (off by default, enable with --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.
  • H042 (off by default, enable with --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:

  • Every linter rule now has a detailed entry on the linter page - what it checks, why it matters, and a verified Don’t/Do example pair - in English, French, Russian and Chinese. Askama, Tera and Liquid get language pages, logos and homepage cards, and engines covered by existing profiles (MiniJinja, Jinjava, Pebble, the Liquid dialects) are noted on the pages of the profiles that cover them.
  • H017 no longer misfires on tags that merely start with a void tag name: <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 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.
  • New rule T039: template tags that never reach their closing delimiter are now reported, e.g. {% 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.
  • New --rules FILE CLI option: load a custom rules file in .djlint_rules.yaml format from any path, instead of only next to pyproject.toml.
  • The formatter now condenses runs of extra whitespace inside single-line template tags to a single space, e.g. {% 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.
  • The default 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:

  • Closing a template block now restores the indentation of its opening tag, so HTML tags left unclosed inside the block (e.g. a wrapper <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 %}.
  • Template tags and expressions spanning multiple lines keep the relative indentation of their contents instead of flattening every line to the tag’s level. Nested objects and arrays in e.g. {% 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.
  • Multiline {% set %} objects nested inside HTML elements are no longer over-indented in proportion to their nesting depth.
  • Self-closing custom block tags (django-components syntax, e.g. {% 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:

  • A single-line block-form {% 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.
  • In multi-line {{ ... }} 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:

  • H020 no longer reports <slot></slot>: an empty slot element is the standard way to declare a default slot outlet.
  • H025 no longer reports a tag as an orphan when the same tag is opened in each branch of an {% if %}/{% else %} and closed once outside it (and vice versa for close tags), since only one branch renders.
  • H025 now reports mis-nested tags whose close tag crosses another open tag, e.g. <b> in <h1>blah <b>bold</h1>.
  • T003 no longer requires an endblock name when {% 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.
  • Linter rules no longer report errors for the literal contents of {% verbatim %}…{% endverbatim %} blocks, matching the existing treatment of jinja {% raw %} blocks.

Configuration:

  • Comma-separated options in config files (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 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.
  • Format django-cotton component tags such as <c-card> and <c-forms.input /> as block HTML tags without requiring custom_html configuration.
  • Preserve whitespace-only content of inline elements as a single space instead of dropping it, so runs like <b>bold</b><span> </span><i>italic</i> keep rendering a space; non-collapsible whitespace such as U+2005 is kept verbatim.
  • Preserve line breaks inside hyperscript _ attribute values, where a newline separates commands and -- comments run to the end of the line.
  • Stop inserting line breaks into attribute values that render whitespace verbatim; only class and style values are spread over multiple lines with format_attribute_template_tags.
  • Leave {% comment %} block content untouched when reformatting, e.g. bare URLs ending in />.
  • Apply rule-specific djlint:off RULE suppression to any finding overlapping the region, so reformatted guards keep linting clean.
  • Avoid false H037 reports for attribute names with a conditional template prefix, e.g. {% if x %}data-{% endif %}srcset.
  • Avoid false reports for HTML-like content inside template tag arguments, e.g. H008 on quotes in a string argument.
  • Preserve conditional attribute names and significant whitespace in template-generated attributes.
  • Keep parent closing tags aligned after multiline inline content.
  • Avoid false H026 reports when id or class is followed by a spaced equals sign.
  • Keep short tag contents inline when attributes contain template expressions.
  • Avoid false D018/J018 reports for links using valid URI schemes.
  • Indent content inside Twig embed blocks.
  • Avoid false H037 reports for attributes in mutually exclusive template branches.
  • Respect exclude and extend_exclude for explicitly provided files.
  • Preserve attributes containing nested template blocks when wrapping long tags.
  • Preserve template expressions used in dynamic HTML tag names.
  • Preserve asterisks in HTML attribute names such as htmx response targets.
  • Avoid adding trailing whitespace after function calls in multiline template expressions.
  • Avoid false T002 reports for template tags inside HTML attributes.
  • 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.
  • Preserve template expressions in HTML attribute names when wrapping attributes.
  • Preserve indentation after void tags containing markup in quoted attributes.
  • Keep Jinja comments and set tags idempotently indented with preserve_leading_space.
  • Avoid false H026 reports when id appears inside quoted attribute values.
  • Avoid false D018/J018 reports for action parameters inside quoted template URL helper attributes.
  • Report H007 when leading template tags appear before an HTML tag without a preceding doctype.
  • Keep blank_line_after_tag from inserting blank lines inside multiline HTML attribute values, preserving idempotent reformatting for embedded template tags.
  • Report T003 when {% endblock name %} does not match its opening {% block name %}.
  • Report H025 when list tags are nested inside <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.
  • Keep repeated single-line Django {% 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.
  • Preserve inline template blocks embedded in rendered text or captured content so formatting does not add meaningful whitespace or misalign following content.
  • Keep chained Jinja function calls and lookups intact when formatting template expressions.
  • Preserve whitespace-sensitive Django filter blocks instead of moving punctuation or translated text around them.
  • Keep Jinja/Nunjucks-trimmed <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.
  • Preserve Jinja template comments inside formatted <script> and <style> blocks.
  • Avoid false H025 reports for HTML-like strings inside template tags.
  • Preserve Jinja template tags inside formatted <script> and <style> blocks.
  • Revise the minimum required dependency versions:
    • click raised from 8.0.1 to 8.2.0
    • cssbeautifier lowered from 1.14.4 to 1.13.0
    • jsbeautifier lowered from 1.14.4 to 1.13.0
    • json5 raised from 0.9.11 to 0.10.0
    • pathspec lowered from 0.12 to 0.9.0
    • pyyaml lowered from 6 to 5.1
    • regex lowered from 2023 to 2021.8.21
    • tomli is lowered from 2.0.1 to 0.2.0
  • Return 1 when no files match the requested lint or format run.
  • Make --check - return 1 when formatting changes are needed.
  • Keep progress output off stdin runs.
  • Defer runtime-only imports until the CLI code paths that need them.
  • Process stdin formatting in memory instead of creating a temporary file.
  • Avoid creating an executor when a run only has one worker.
  • 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 dependencies now that Click handles CLI colors and progress.
  • Avoid false H025 reports after self-closing tags in Django templates.
  • Avoid false H025 reports for multiline Go template attributes.
  • Keep Django child-template reformatting idempotent when inline control blocks also appear inside HTML attributes.
  • Respect whitespace-control dashes when applying blank_line_after_tag and blank_line_before_tag.

v1.39.1 was not published due to mypyc compilation error.

  • Fix mypyc compilation.
  • Avoid false T027 reports for apostrophes inside quoted template strings.
  • Format Alpine.js object methods in attributes when format_attribute_js_json is enabled.
  • Preserve indentation after inline Jinja control-flow blocks that start with whitespace trim markers, such as {%- if ... %}...{% endif %}.
  • Preserve safe inner quote style for Jinja function calls inside quoted HTML attributes.
  • Add preserve_class_newlines / --preserve-class-newlines to keep authored line breaks inside multiline class attributes.
  • Fix Django 6.0 {% partialdef %} block indentation so {% endpartialdef %} aligns with its opener.
  • Preserve multiline Django/Jinja control-flow blocks instead of condensing short bodies onto one line.
  • Preserve single-line inline HTML and template tag bodies during expansion, even when they exceed max_line_length.
  • Fix python -m djlint not working due to mypyc compilation.
  • Match exclude paths on path boundaries.
  • Add support for .djlint.toml project and global config files.
  • Preserve single-line inline HTML tag bodies when they fit within max_line_length.
  • Avoid evaluating template expressions while formatting tag contents.
  • Fix npm publish workflow.
  • Add --format-attribute-js-json for formatting JavaScript and JSON inside HTML attributes. It also supports format_attribute_js_json_pattern and format_attribute_js_json_min_props for tuning which attributes are formatted. Thanks, @oliverhaas.
  • Add --github-output for GitHub Actions annotations. Thanks, @iloveitaly.
  • Fix ignore_blocks matching when ignored blocks are indented. Thanks, @tdryer.
  • Use relative paths for --exclude and --use-gitignore matching so path filters work consistently from nested directories. Thanks, @satya-waylit.
  • Stop D018/J018 from flagging root links such as href="/". Thanks, @SAY-5.
  • Do not treat soft hyphen entities as text for H023. Thanks, @kotutuloro.
  • Fix Handlebars {{#unless}} indentation. Thanks, @S1mplePixels.
  • Fix formatting when /> appears inside an HTML attribute value. Thanks, @novucs.
  • Improve CPU count handling for worker setup.
  • Improve formatter caching and reduce cache memory usage. Formatting is about 19% faster.
  • Add Chinese translation. Thanks, @Twisuki.
  • Add Homebrew installation instructions. Thanks, @alfawal.
  • Add EFM Neovim integration documentation. Thanks, @danielebra.
  • Add copy-pastable pre-commit YAML to the README. Thanks, @Pierre-Sassoulas.
  • Polish linter and CLI documentation. Thanks, @jasonaowen and @dotWee.
  • Drop Python 3.9 support.
  • Fix specific mixture of quotes and escaped quotes (e.g. in a json string in an html attribute) breaks the html. Thanks, @oliverhaas.
  • Fix broken formatting of template tags inside template tags. Thanks, @oliverhass.

This release reverts the following changes from the last release as they caused issues:

  • Fix specific mixture of quotes and escaped quotes (e.g. in a json string in an html attribute) breaks the html. Issue #1048.
  • Resolve exclude paths. Issue #1047.

Fix:

  • Fix specific mixture of quotes and escaped quotes (e.g. in a json string in an html attribute) breaks the html. Thanks, @oliverhaas.
  • Resolve exclude paths. Thanks, @antoineauger.

Performance:

  • Minor regex indent optimization. Thanks, @oliverhaas.
  • Improve performance by ~30%. Thanks, @oliverhaas.
  • Add support for djlint.toml config file. The format is identical to pyproject.toml, but it does not use [tool.djlint] table.
  • Do not format HTML in attributes. Thanks, @oliverhaas.
  • Fix using js_config instead of css_config.
  • Increase performance by ~30% by using regex more efficiently and caching more stuff.

Compiled mypyc wheels are now also available, which improve performance by ~21% over Pure Python. They will be automatically installed by your package manager when available for your platform. Pure Python wheel is still available.

Other changes have been made to improve performance, thanks to @JCWasmx86. See the commits for more details.

Formatting performance comparison with the previous version (tested on https://github.com/openedx/edx-platform with single thread):

Version Seconds
v1.35.3 20.39
v1.35.4 pure Python 14.39
v1.35.4 compiled 11.35

This release significantly improves performance, especially for large files and large projects.

Formatting https://github.com/openedx/edx-platform took 87 seconds in the previous version, now it takes only 4 seconds (>2000% speedup)! Tested on a 32-core computer.

  • Performance improved by caching some functions. Thanks to @JCWasmx86!
  • Removed the limitation on the number of workers introduced in v1.35.0.
  • Drop Python 3.8 support.
  • Fix npm publishing
  • Fix npm publishing
  • Unpin dependencies upper bounds.
  • Use min(cpu_count, files_count, 4) workers. Use a thread instead of a process if only one worker will be used. This gives the best performance and low resource usage.
  • Refactor the code.
  • Fix max attribute length with longer regex custom html tags (#884)
  • Fix Jinja formatting issues (#715)
  • Fix: not detecting tabs as a valid seperation between tags (#813)
  • Fix: Add ignore for sms links (#815)
  • Fix: Allow attributes on (#830)
  • max attribute length with longer regex custom html tags (#884)
  • formatter: Avoid rewriting the file if it has not been changed
  • linter: fix missed H025 for double closing, closes #786
  • configuration: Fix formatting, unused import and forgotten print
  • configuration: Accept pyproject.toml as a —configuration argument
  • formatter: fixed extra breaks added around html tags inside template tags, closes #742
  • formatter: fixed extra indend in script tags, closes #733
  • formatter: fixed formatting on functions that used python keywords as the param name, closes #756
  • h033: fix rull to not match data-action
  • linter: fixed false positive on DJ018, closes #755
  • formatter: added support for nunjucks async loop tags
  • formatter: reverted chained function formatting, closes #720 #704
  • formatter: fixed formatting on chained function, closes #704
  • linter: fixed false positive on h026 data-id, closes #711
  • linter: fixed golang false positive on T027, closes #712
  • formatter: added support for jazzband’s sorl-thumbnail tags, closes #714
  • formatter: fixed formatter formatting ignored code, closes #655
  • formatter: fixed function formatting with nested quoted parenthesis, closes #698
  • formatter: fixed overgrabbing on template tag condensing, closes #686
  • formatter: function index was not formatted correctly, closes #693
  • formatter: fixed line_break_after_multiline_tag to force break in all cases, closes #680
  • formatter: fixed isolated quotes being deleted from attributes, closes #652
  • formatter: fixed wild match on template tags, closes #686
  • linter: fixed false positive on t001, closes #606
  • formatter: added max-blank-lines flag to consolidate blank lines, closes #675
  • formatter: added support for symphony forms, closes #476
  • formatter: added quotes to json keys, added option to disable set/function formatting, closes #682
  • linter: added missing positive on H021, closes #678
  • linter: fixed false positive on H037, closes #679
  • formatter: fixed endset indent level, closes #670
  • formatter: fixed issue with spaceless macro tags having spacess added before -, closes #667
  • npm: install exact version of djlint
  • npm: add script to update djlint version in postinstall using semantic-release/exec
  • formatter: fix cases where ignore was still formatting set and function code, closes #659
  • formatter: fix extra parenth being added in a function call, closes #660
  • linter: fixed missing positive on a few <img rules
  • formatter: added option to disable newlines after yaml front matter, closes #662
  • linter: allow codes to be ignored for remainder of file, closes #655
  • formatter: allow djlint:off to exluce the rest of a file, closes #649
  • formatter: don’t add blank line to empty files, closes #635
  • formatter: added ability to format objects/arrays in function tags, closes #370
  • formatter: format set blocks, closes #646
  • formatter: fixed an edge case wild regex grab, closes #640
  • formatter: fixed formatting of plural tag in blocktrans, closes #641
  • formatter: fixed js/css being formatted even inside ignored blocks, closes #613
  • linter: fixed a few false positives/missing positives, added tests, closes #643 #642
  • linter: fixed false postive in alpinejs tags for H037, closes #639
  • formatter: fixed set_ tags being broken, closes #634
  • linter: fixed false positive on H037, closes #633
  • linter: fixed overly greedy H037, improved linter tests, closes #631
  • formatter: Add option to not condense multi-line-tags
  • blocktrans: fixes whitespace issues on blocktrans, allows indenting on blocktrans trimmed, closes #623
  • formatter: added white space cleanup for template tags, closes #485
  • linter: added rule H037
  • void tags: added option to auto close void tags (linter rule H017), closes #252
  • js indent: fixed an issue where literal strings were double indented, closes #614
  • set: added formatting of json/list style set contents, closes #287 #518 #370
  • formatter: fixed extra indent on endblocktrans tags, closes #611
  • cli: added all args to cli, closes #595
  • formatter: added option to prevent contents of some template tags from indenting
  • formatter: fixed speed on formatter, closes #601
  • blocktrans: fix issue with back to back blocktrans formatting, closes #600
  • yaml: fixed conflict with yaml and preserve_blank_lines option, closes #596
  • formatter: will now attempt to fix case on known html tags by default, can be disabled, closes #589
  • whitespace: improved whitespace handling on tag closing bracket, closes #582
  • linter: added rule H036. Avoid use of
    tags. Disabled by default, closes #571
  • linter: added option to disable rules by default. Split H017 and disabled by default, closes #372
  • yaml: added line break after yaml front matter, closes #584
  • blocktrans: allowed closing transblocks to be indented if they have a leading space
  • custom tags: fixed issue where end tag for custom block was not de-indented, closes #572
  • ignored code: fixed formatting of ignore code inside django comment blocks, closes #569
  • linter: linter will now ignore {% raw %} {% endraw %} blocks, closes #539
  • max line length: fixes issues around max line length not fully respected on indented lines, closes #580
  • preserving space: misc improvements for the preserve leading space option, closes #566
  • ignored rules: prevent ignoring a single rule from ignoring multiple, closes #560
  • formatter: fixed template tag formatting with trailing parenthesis, closes #554
  • config: added error message print when config loading fails, closes #531
  • handlebars each: fixed bug in handlebars tags w/ trailing pipe, closes #529
  • docs: fixed doc build
  • formatter: preserve windows line endings, closes #502
  • linter: fixes false positive on D018, closes #501
  • check: fixed issue where check was reformatting files that contained a hyphen in the name, closes #494
  • stdin —check: stdin with the —check flag should return a formatted output, closes #486
  • attributes: fixed outer quotes being stripped from attribute values, closes #471
  • settings: fixed pyproject loader, closes #469
  • textarea: fixed textarea attribute formatting, closes #486
  • formatter: fixed a few broken alpinejs attributes, closes #448
  • css/js: fixed extra blank lines being appended to blank lines in css/js formatter, closes #451
  • linter: make attribute pattern on H025 more accepting. Prevent false positive, closes #447
  • attributes: fixed poor django attribute parsing, closes #427 #438
  • attributes: prevented attribute indentation for url type attributes, closes #320 #86 #195
  • image tag: added image tag to template break tag list. srcset formatting, closes #444
  • formatter: fixed poor formatting on long inline blocks, closes #432
  • windows+py3.9: fixed an issue on windows with py3.9 and stdin
  • formatter: fixed indent on inline block followed by inline template block, closes #425
  • formatter: fixed formatting on nested inline comments, closes #423
  • configuration: allow local configuration to override global config, closes #422
  • quiet: updated output of the —quiet flag to reduce unneeded verbose stuff
  • linter: fixed false positive on H017. Added test, closes #406
  • linter: fixed false positive on T002. Added tests, closes #405
  • formatter: fixed issue with blank links added between blocks, closes #402
  • formatter: fixed poor indentation on span tags with leading text, closes #398
  • t002: fixed false positive in t002. Added test, closes #399
  • stats: moved linter stats to be appended to lint output, closes #396
  • linter: t002
  • linter: added —statistics flag to print summary of linter findings, closes #389
  • formatter: fixed formatting of repeating inline tags, closes #387
  • linter t034: added linter T034 to check for {% … }% typo, closes #385
  • linter: t002 added a few more tags to the check, closes #386
  • span: fixed indent on nested inline tags on a span, closes #383
  • alpine js: fix incorrect indent on alpinejs attribs w/ nested HTML, closes #381
  • config: allow source files to be specified in the config file, closes #371
  • config: added option for custom configuration file path, closes #170
  • windows: added a better progress bar char for windows, closes #286
  • cssbeautify: added support for ignore in cssbeautifier
  • js formatting: added support for jsbeautify ignore blocks, closes #367
  • release: trigger a release to remove the print statment
  • macro: allow html tags inside macro functions to skip formatting, closes #353
  • t001: fixed false positive on T001 with Jinja {{- and {{+ tags, closes #354
  • h006: prevented false positives on H006, closes #344 #333
  • h012: prevent H012 from matching the contents of tags or attributes, closes #348
  • t001: fixed false positive on multiline template tags, closes #350
  • h021: allow inline styles that contain template syntax, closes #351
  • t002: allow variables names to be used in the {% extends tag, closes #349
  • formatter: fixed runaway regex on templates with many template attriutes inside html tags, closes #340
  • linter: fixed false positive on T032 with jinja multi line set, closes #342
  • linter: fixed false postive on rule H008, closes #339
  • linter: prevent linter matches that overlap ignored blocks of code such as comments, closes #343
  • jinja call: added support for jinja call blocks, closes #337
  • linter: updated rule 18 to allow “tel:”, closes #334
  • formatter: fix IndexError while adding indentation to attributes, closes #290
  • requirements: removed optional deps from requirements section. Cleaned up tox, closes #322
  • formatter: fix to prevent formatter from breaking malformed attribute tags, closes #317
  • linter: disabling linter rules should not disable formatting, closes #316
  • t027: fixed test and regression in T027, closes #141
  • formatter: fixed greedy regex issue when finding script and style tags
  • formatter: added options to format css and js using jsbeautifier
  • indent: fixed bad indent on short blocks, closes #309
  • formatter: added option to add blank line before tags, closes #307
  • linter: fixed false positive on T027, closes #301
  • preserve blank lines: fixed duplicate blank lines being inserted after h-space,, closes #300
  • white space: prevent duplicate blank lines from being added, closes #297
  • linter: fix false positive on rule T001, closes #292
  • twig: fixed indent issue with comments. Added test, closes #290
  • git bash: fixes char encoding on windows git bash, closes #275
  • linter: added per-file-ignores as a config option for linter rules, closes #107
  • npm: added npm publish
  • h026: fixes rule H026 for cases where id/class are part of another string, closes #281
  • npm: updated npm installer, closes #192
  • ignore rules: added option to ignore linter rules with inline comments, closes #113
  • h025: fixes rule H025 where tags have curly hash, closes #270
  • new option: added option to attempt to keep blank lines in templates, closes #261
  • curly hash comment: fix formatting on curly hash comment blocks, closes #265
  • whitespace: add option to preserver some whitespace before text, closes #260
  • windows: fixed windows output. colorama was converting to cp1252
  • dj018: fix rule DJ018 for special attrib names, closes #248
  • stdin encoding: added encoding to stdin text, closes #243
  • breaks: allowed p, head, and body tags that are short/empty to be on a single line
  • code tags: fixed indentation on code tags w/ trailing text, closes #244
  • Bug fixes #189, #197
  • Added --warn flag to return return errors as warnings.
  • Bug fixes #187
  • Added better support for yaml front matter in template files
  • Added rule T032 for #123
  • Added rule H033 for #124
  • Changed linter profiles to be inclusive vs exclusive for #178
  • Added alternate config file option .djlintrc for #188
  • Bug fixes #173, #174
  • Dropped Py3.6 from pyproject.toml.
  • Added config for custom HTML tags
  • Bug fixes
  • Added HTML and Angular profiles
  • Allowed some entities in rule #H023
  • Bug fixes
  • Bug fixes
  • Updated docs
  • Added config option format_attribute_template_tags as opt-in for template tag formatting inside of attributes
  • Added config option linter_output_format to customize linter message variable order
  • Added rules H030 and H031 to check meta tags
  • Big fixes
  • Updated output paths to be relative to the project root
  • Bug fixes
  • Bug fixes
  • Added support for django blocktrans tag
  • Bug fixes
  • Bug fixes
  • Bug fixes
  • Made rule T028 stricter with clearer message
  • Added rule T027 to check for unclosed in template syntax
  • Added rule T028 to check for missing spaceless tags in attributes
  • Added rule H029 to check for lowercase form method
  • Ignored django blocktranslate tags that do not have “trimmed” from formatter
  • Bug fixes
  • Added test support for python 3.10
  • Added pre-commit hook
  • Added option --use-gitignore to extend the excludes
  • Changed default exclude matching
  • Fixed windows exclude paths
  • Fixed formatting of {%...%} tags in attributes
  • Fixed formatting for for loops and nested conditions in attributes
  • Added require_pragma option
  • Updated DJ018 to catch data-src and action on inputs
  • Fixed inline ignore syntax
  • Added --lint option as placeholder for default usage
  • Bug fixes
  • Bug fixes
  • Added rule H026 to find empty id and class tags
  • Bug fixes
  • Consolidated settings and slimmed code
  • Bug fixes
  • Added rule H020 to find empty tag pairs
  • Added rule H021 to find inline styles
  • Added rule H022 to find http links
  • Added rule H023 to find entity references
  • Added rule H024 to find type on scripts and styles
  • Added rule H025 to check for orphan tags. Thanks to https://stackoverflow.com/a/1736801/10265880
  • Improved attribute formatting
  • Updated blank_line_after_tag option to add newline regardless of location
  • Fixed django trans tag formatting
  • Added formatting for inline styles
  • Added formatting for template conditions inside attributes
  • Added srcset as possible url location in linter rules
  • Speed up formatting
  • Special thanks to jayvdb
  • Change stdout for --reformat/check options to only print new html when using stdin as the input
  • Split alt requirement from H006 to H013
  • Added optional custom rules file
  • Added golang as profile option
  • Fixed formatting of ignored blocks containing inline comments
  • Added default text to --indent and -e options
  • Update url rules to accept #
  • Fixed file encoding on Windows OS
  • Fix single line template tag regex
  • Fix blank_line_after_tag for tags with leading space
  • Added rule H019
  • Fixed bugs in DJ018 and H012
  • Fixed several regex matching bugs in linter rules
  • Stopped linter from returning errors in ignored blocks
  • Added option to ignore code block from linter/formatter with {% djlint:off %}...{% djlint:on %} tags
  • Fixed bug #35
  • Fixed bug #34
  • Moved source tag to single line tags
  • Fixed bug #31
  • Added best practices to docs
  • Add --profile option to set default linter/formatter rules
  • Added linter rules for jinja url patterns
  • Change indent config from string to int. --indent 3
  • Added cli option for indent spacing. --indent=" "
  • Added support for additional whitespace after tags with blank_line_after_tag option
  • Added support for processing several files or folders at once
  • Fixed formatting of django {# ... #} tags
  • Added indent support for figcaption, details and summary tags
  • Added support for overriding or extending the list of excluded paths in pyproject.toml
  • Updated attribute handling
  • Added support for stdin
  • Fixed formatting on small, dt, and dd tags
  • Added formatter support for Nunjucks {%- opening blocks
  • Added support for more Django blocks
  • Added support for custom blocks
  • Added support for config in pyproject.toml
  • Fixed Nunjucks spaceless tag -%} format
  • Allowed short div tags to be single line
  • Fixed Django comment formatting
  • Ignored textarea from formatting
  • Updated attribute formatting regex
  • Updated lint rule W010
  • Changed exit code to 1 if there were any formatting changes
  • Added support for Jinja asset tags
  • Updated W018 regex
  • Removed duplicate lint messages
  • Updated E001 for Handlebars
  • Fixed progress bar error for old Click version

Releases from 0.0.5 (2021-07-12) to 0.2.7 were published without release notes.