Skip to content

djlint

djlint documentation

toolroom._stubs.djlint.Djlint

Bases: Tool[_R]

__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 = ...,
    line_break_after_multiline_tag: Flag = ...,
    lint: Flag = ...,
    linter_output_format: Value = ...,
    max_attribute_length: Value = ...,
    max_blank_lines: Value = ...,
    max_line_length: Value = ...,
    no_function_formatting: Flag = ...,
    no_line_after_yaml: Flag = ...,
    no_set_formatting: Flag = ...,
    per_file_ignores: Value = ...,
    preserve_blank_lines: Flag = ...,
    preserve_class_newlines: Flag = ...,
    preserve_leading_space: Flag = ...,
    profile: Value = ...,
    quiet: Flag = ...,
    reformat: Flag = ...,
    require_pragma: Flag = ...,
    rules: Value = ...,
    single_attribute_per_line: 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

Add an additional blank line after {% .

...
blank_line_before_tag Value

Add an additional blank line before {% .

...
check Flag

Check formatting on the file(s).

...
close_void_tags Flag

Add closing mark on known void tags.

...
configuration Value

Path to global configuration file in djlint.toml, .djlint.toml, or .djlintrc format.

...
custom_blocks Value

Indent custom template blocks.

...
custom_html Value

Indent custom HTML tags.

...
exclude Value

Override the default exclude paths.

...
extend_exclude Value

Add additional paths to the default exclude.

...
extension Value

File extension to check. Defaults to html.

...
format_attribute_js_json Flag

Also format JavaScript/JSON inside HTML attributes.

...
format_attribute_js_json_min_props Value

Minimum number of properties to treat attribute content as JS/JSON.

...
format_attribute_js_json_pattern Value

Regex pattern to match JavaScript attributes.

...
format_attribute_template_tags Flag

Attempt to format template syntax inside of tag attributes.

...
format_css Flag

Also format contents of