Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] [Formatter] <span> is enforced on a new line #171

Closed
3 tasks done
vchga opened this issue Jan 12, 2022 · 3 comments
Closed
3 tasks done

[BUG] [Formatter] <span> is enforced on a new line #171

vchga opened this issue Jan 12, 2022 · 3 comments
Assignees
Labels
Projects

Comments

@vchga
Copy link

vchga commented Jan 12, 2022

System Info

  • OS: ubuntu 20.04
  • Python Version 3.8.10
  • djLint Version master >0.7.1
  • template language: django

Issue

<span> tag is formatted on a new line, but this introduces unwanted whitespaces. For example if I'd like to highlight first letter in a word.

How To Reproduce

INPUT

<div class="hi">
    <div class="poor">
        <p class="format">
            <strong>H</strong>ello stranger, <strong>do not wrap span</strong>, <strong>pls</strong>.
            <span class="big">H</span>ello stranger, <strong>do not wrap span</strong>, <span class="big">pls</span>.
        </p>
    </div>
</div>

OUTPUT

<div class="hi">
    <div class="poor">
        <p class="format">
            <strong>H</strong>ello stranger, <strong>do not wrap span</strong>, <strong>pls</strong>.
            <span class="big">H</span>
            ello stranger, <strong>do not wrap span</strong>,
            <span class="big">pls</span>
            .
        </p>
    </div>
</div>

I'd like the <span> not to be formatted on a new line, <span> is inline element by default, so I think it's better to not wrap it same as e.g. <strong>. At least in cases where it's not surrounded by spaces.

When I investigated this I also tried to use max_line_length in pyproject.toml (as per docs), but I did not understand how it works - no matter of a value I used (60, 120, 200) the above example was returning the same results (I'd expect this to wrap lines).

Could someone explain me how should max_line_lenght work, please? (maybe I have something wrong in the config and it's not applied, but I don't know how to check as max_line_length behavior is not clear.

pyproject.toml is placed in the root of the project, where I execute djlint

[tool.djlint]
profile="django"
max_line_length=60

Thanks a lot.

@vchga vchga added 🦠 bug Something isn't working 🧽 formatter labels Jan 12, 2022
@github-actions github-actions bot added this to Needs triage in bugs Jan 12, 2022
bugs automation moved this from Needs triage to Closed Jan 14, 2022
@vchga
Copy link
Author

vchga commented Jan 14, 2022

Thanks for the fix! 🥇
It's ok on 0.7.2.

@christopherpickering
Copy link
Contributor

christopherpickering commented Jan 14, 2022 via email

@christopherpickering
Copy link
Contributor

🎉 This issue has been resolved in version 1.0.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
bugs
  
Closed
Development

No branches or pull requests

2 participants