Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

ethan-vanderheijden
Copy link
Contributor

@ethan-vanderheijden ethan-vanderheijden commented Feb 3, 2024

Resolves: #812

  • Added tests for changed code.

It wasn't detecting tabs as a valid whitespace between HTML tags, causing it to transform:
<div>\n\t<p></p>\n</div>
into:
<div>\n\t\n<p></p>\n</div>

Notice that the transformed text has an extra new line after the tab character. Normally extra new lines are removed, but with --preserve-blank-lines, this extra new line persists.

Note:

  • --preserve-blank-lines and --max-blank-lines are incompatible with each other (I think this was true before my PR). Since --max-blank-lines preserves blank lines as well, it would make a lot of sense to combine the two options into one.

@netlify
Copy link

netlify bot commented Feb 3, 2024

Deploy Preview for djlint canceled.

Name Link
🔨 Latest commit 3f84651
🔍 Latest deploy log https://app.netlify.com/sites/djlint/deploys/65fed174be3f1e0008d45a4a

@ethan-vanderheijden ethan-vanderheijden force-pushed the fix-preserve-blank-line-with-tabs branch from 701c70c to 3f84651 Compare March 23, 2024 12:56
@monosans monosans changed the base branch from master to dev July 12, 2024 13:20
@monosans
Copy link
Member

Thank you!

@monosans monosans merged commit ab9e467 into djlint:dev Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] [Formatter] --preserve-blank-lines does not work on files indented with tabs.

2 participants