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.

HTML -> No Django template tags support {% tag %}

See original GitHub issue

Prettier 1.15.3 Playground link

--parser html
--print-width 100

Input:

{% extends 'base.html' %}

{% block content %}
	<div class="content"></div>

	{% for item in items %}
  		{{ item.name }}
        {% endfor %}

	{% include '_template.html' %}
{% endblock %}

Output:

{% extends 'base.html' %} {% block content %}
<div class="content"></div>

{% for item in items %} {{ item.name }} {% endfor %} {% include '_template.html' %} {% endblock %}

Expected behavior:

{% extends 'base.html' %}

{% block content %}
	<div class="content"></div>

	{% for item in items %}
  		{{ item.name }}
        {% endfor %}

	{% include '_template.html' %}
{% endblock %}

Django’s (and other frameworks using this notation) {% tag %}{% endtag %} should be treated like blocks. Right now prettier creates hell of a mess 😕

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:111
  • Comments:38 (4 by maintainers)

github_iconTop GitHub Comments

37reactions
Ivrajcommented, Aug 22, 2019

@robertquitt Any progress on that Django plugin?

28reactions
riodwcommented, Jan 25, 2019

This would greatly improve my life 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Built-in template tags and filters - Django documentation
This document describes Django's built-in template tags and filters. It is recommended that you use the automatic documentation, if available, ...
Read more >
Prettier vscode extension not support Django template tags ...
When using "prettier.disableLanguages": ["django-html"] I got the below warning in VS Code: This feature is no longer supported.
Read more >
Django Templates: Built-In Tags and Filters - Real Python
You'll get to know Django templates through the tags and filters you use to compose reusable HTML. In this tutorial, you'll learn how...
Read more >
Django Template Tags - W3Schools
Well organized and easy to understand Web building tutorials with lots of examples of how to use HTML, CSS, JavaScript, SQL, PHP, Python,...
Read more >
Create Custom Template Tags and Filters in Django - Pluralsight
The Django template language offers a wide range of built-in tags and filters ... named users.html using the show_users_table template tag.
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