djlint¶
Djlint ¶
Djlint(name: str, *base: str, in_process: bool = False, path: str = '', entry: str = '', single_dash: bool = False, version_argv: tuple[str, ...] = ('--version',), policy: dict[str, Any] | None = None)
Bases: Tool[_R]
Methods:
| Name | Description |
|---|---|
__call__ |
djLint ยท HTML template linter and formatter. |
Attributes:
| Name | Type | Description |
|---|---|---|
argv |
Djlint[Argv]
|
|
__call__ ¶
__call__(src: str | PathLike[str], /, *args: str | PathLike[str], allow_empty_input: Flag = ..., blank_line_after_tag: Value = ..., blank_line_before_tag: Value = ..., check: Flag = ..., close_void_tags: Flag = ..., configuration: Value = ..., custom_blocks: Value = ..., custom_html: Value = ..., exclude: Value = ..., extend_exclude: Value = ..., extension: Value = ..., format_attribute_js_json: Flag = ..., format_attribute_js_json_min_props: Value = ..., format_attribute_js_json_pattern: Value = ..., format_attribute_template_tags: Flag = ..., format_css: Flag = ..., format_js: Flag = ..., github_output: Flag = ..., ignore: Value = ..., ignore_blocks: Value = ..., ignore_case: Flag = ..., include: Value = ..., indent: Value = ..., indent_css: Value = ..., indent_js: Value = ..., keep_br_inline: Flag = ..., line_break_after_multiline_tag: Flag = ..., lint: Flag = ..., linter_output_format: Value = ..., lsp: Flag = ..., max_attribute_length: Value = ..., max_blank_lines: Value = ..., max_line_length: Value = ..., name_endblocks: Flag = ..., no_entity_formatting: Flag = ..., no_function_formatting: Flag = ..., no_indent_inner_html: Flag = ..., no_line_after_yaml: Flag = ..., no_set_formatting: Flag = ..., per_file_ignores: Value = ..., prefer_configuration: Flag = ..., preserve_blank_lines: Flag = ..., preserve_class_newlines: Flag = ..., preserve_leading_space: Flag = ..., profile: Value = ..., quiet: Flag = ..., quote_style: Value = ..., reformat: Flag = ..., require_pragma: Flag = ..., rules: Value = ..., sarif: Flag = ..., single_attribute_per_line: Flag = ..., sort_attributes: Flag = ..., sort_load_tags: Flag = ..., statistics: Flag = ..., stdin_filename: Value = ..., use_gitignore: Flag = ..., warn: Flag = ..., **flags: Any) -> _R
djLint ยท HTML template linter and formatter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
allow_empty_input
|
Flag
|
Exit with 0 instead of 2 when the given paths match no files. Added in 1.44.0. |
...
|
blank_line_after_tag
|
Value
|
Template tags to follow with a blank line, comma-separated, for example load,extends. |
...
|
blank_line_before_tag
|
Value
|
Template tags to precede with a blank line, comma-separated, for example load,extends. |
...
|
check
|
Flag
|
Show what formatting would change, without changing the files. |
...
|
close_void_tags
|
Flag
|
Close void tags with a slash, so |
...
|
configuration
|
Value
|
Global config file: a pyproject.toml, djlint.toml or .djlintrc. |
...
|
custom_blocks
|
Value
|
Names of the custom template blocks to indent, comma-separated, for example toc. |
...
|
custom_html
|
Value
|
Names of the custom HTML tags to indent, comma-separated, for example mjml. |
...
|
exclude
|
Value
|
Regexes of the paths to skip, comma- separated, in place of the default list. |
...
|
extend_exclude
|
Value
|
Regexes of the paths to skip on top of the exclude list, comma-separated. |
...
|
extension
|
Value
|
Extension of the files to look for in folders. Defaults to |
...
|
format_attribute_js_json
|
Flag
|
Also format JavaScript and JSON in attributes such as onclick and x-data. |
...
|
format_attribute_js_json_min_props
|
Value
|
Format an object only when it has at least this many properties. Defaults to |
...
|
format_attribute_js_json_pattern
|
Value
|
Regex for the names of the attributes to format as JavaScript or JSON. Defaults to |
...
|
format_attribute_template_tags
|
Flag
|
Format template syntax inside tag attributes. |
...
|
format_css
|
Flag
|
Also format the contents of |