Feature
- Add
djlint.api, a supported way to format and lint text from Python:load_config(),format_text()andlint_text(), which returns findings with numeric positions. See Python API. - A finding now knows where it ends.
--linter-output-formattakes{end}, SARIF reportsendLineandendColumn, and GitHub annotations cover the whole finding. A custom rule'spython_modulecan returnend, and otherwise ends where itsmatchdoes. - A custom rule's
python_moduleis also looked for in the project root, after everything else on the path, so it works with thedjlintcommand as well as withpython -m djlint.
Changed
- A
python_modulerule that returns alinethat isn't a position now stops djLint with an error naming the rule, instead of a traceback from the report.
Fix
- A tag whose attributes are spread over several lines, but that doesn't start its line, as in
<li><a …>orRead the <a …>, is laid out from that line. The attributes line up under the first one, or with--single-attribute-per-linesit 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.