Skip to content

[BUG] [Formatter] indentation after <link rel="icon" #1544

@chiptoe

Description

@chiptoe

System Info

Python 3.10.12
djlint, version 1.36.4

  • template language:
    • *.html.twig (Symfony 6.4)
    "scripts": {
        "djlint:lint":     "djlint . --exclude ./vendor/ --extension html.twig --profile nunjucks --lint",
        "djlint:check":    "djlint . --exclude ./vendor/ --extension html.twig --profile nunjucks --check",
        "djlint:reformat": "djlint . --exclude ./vendor/ --extension html.twig --profile nunjucks --reformat"
    },

Issue

input:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">

        {# Fixes zoom on mobile. #}
        <meta name="viewport" content="width=device-width, initial-scale=1.0">

        <title>{% block title %}Welcome!{% endblock %}</title>
        <link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 128 128%22><text y=%221.2em%22 font-size=%2296%22>⚫️</text><text y=%221.3em%22 x=%220.2em%22 font-size=%2276%22 fill=%22%23fff%22>sf</text></svg>">
        {% block stylesheets %}
        {% endblock %}

        {% block javascripts %}
            {% block importmap %}{{ importmap('app') }}{% endblock %}
        {% endblock %}
    </head>
    <body>
        {% block body %}{% endblock %}
    </body>
</html>

all content after:

        <link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 128 128%22><text y=%221.2em%22 font-size=%2296%22>⚫️</text><text y=%221.3em%22 x=%220.2em%22 font-size=%2276%22 fill=%22%23fff%22>sf</text></svg>">

when reformat, has incorrect indentation one level more to the right.
e.g. </html> becomes </html> (not only this line, but also lines above)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions