question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Breaks tags with newline when formatting on save

See original GitHub issue

This (or something else?) puts a newline inside django tags:

{% include 'elements/addedit_campaign_modal.html' with editing=True %} {% endblock %}

becomes:

{% include 'elements/addedit_campaign_modal.html' with editing=True %} {%
endblock %}

and this leads to the syntax error. Any suggestions appreciated!

This is in my settings.json:

"files.associations": {
        "**/*.html": "html",
        "**/templates/**/*.html": "django-html",
        "**/templates/**/*": "django-txt",
        "**/requirements{/**,*}.{txt,in}": "pip-requirements"
    },

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:11 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
72Lcommented, Mar 4, 2021

No news, but what I do is sprinkle in

<!--protect-->
{% tag %}

to protect the tag from formatting.

@batisteo help!

1reaction
chpmrccommented, Mar 15, 2022

I think the point is to make the formatter smarter, not to disable formatting altogether.

Read more comments on GitHub >

github_iconTop Results From Across the Web

VSCode breaks Django template tags with newline
Automatically format *.html files, while preserving django template tags, not breaking them up with newlines. Sub-optimal (but acceptable) ...
Read more >
HTML Line Break – How to Break a Line with the HTML <br ...
You can insert line breaks in HTML with the <br> tag, which is equivalent to a carriage return on a keyboard. Be aware...
Read more >
HTML Tutorial - Line Breaks
Use the line break tag to solve minor formatting issues, save larger page layout issues for tables and the align attribute. Remember that...
Read more >
Basic Formatting | HTML text formatting, paragraphs and line ...
Formatting the Text | Tag Questions | Skipping Lines | Attributes | Headings · So let's see them! ... You use <br> ,...
Read more >
Preserving Line Breaks When Using Jsoup | Baeldung
Thus, by prepending <br> and <p> HTML tags with the newline character, and disabling the pretty-print output setting of Jsoup, we can preserve ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found