Skip to content

djlint

djlint documentation

footman._stubs.djlint.Djlint

Bases: Tool

__call__

__call__(
    src: str,
    /,
    *args: str,
    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 = ...,
    use_gitignore: _Flag = ...,
    warn: _Flag = ...,
    **flags: Any,
) -> Result

djLint · HTML template linter and formatter.

Parameters:

Name Type Description Default
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