Reject multi-line Django '{# #}' template comments (a wrapped '{# #}' renders as visible text).
Project description
django-no-multiline-template-comment
django-no-multiline-template-comment rejects multi-line Django {# … #} template
comments.
Why
Django's {# #} comment is single-line only. A {# whose closing #} is on a
later line does not comment the following lines — they render as visible text on the
page. Use {% comment %}…{% endcomment %} for anything that may wrap. This hook catches
the mistake in CI.
{# ✗ broken: this comment
spans two lines, so everything here leaks onto the page as text #}
{# ✓ fixed: single-line comment #}
{% comment %}
...or {% comment %} for anything that may wrap.
{% endcomment %}
Installation
- repo: https://github.com/Pierre-Sassoulas/django-no-multiline-template-comment/
rev: v0.0.1
hooks:
- id: django-no-multiline-template-comment
Autofix
Pass --fix to rewrite offending comments to {% comment %}…{% endcomment %} in place
(valid single-line comments and unterminated {# are left untouched). As with other
fixer hooks, a rewritten file fails the run so you review and re-stage it.
- repo: https://github.com/Pierre-Sassoulas/django-no-multiline-template-comment/
rev: v0.0.1
hooks:
- id: django-no-multiline-template-comment
args: [--fix]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_no_multiline_template_comment-0.0.1.tar.gz.
File metadata
- Download URL: django_no_multiline_template_comment-0.0.1.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3c79f90c3996bba6332dc43410128315c9418535b196ba972bc6338af69e99df
|
|
| MD5 |
9a9434b88214abe31c90b5a928275c83
|
|
| BLAKE2b-256 |
1197a9b6469c0d55e4ed1365f58bc735b02c1c9ee422ad235b4b044de40a2fa4
|
File details
Details for the file django_no_multiline_template_comment-0.0.1-py3-none-any.whl.
File metadata
- Download URL: django_no_multiline_template_comment-0.0.1-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
76943da7ca9741bf03b5d325e007efefa6e4588c263f405c6a3f132f7e8fe8fe
|
|
| MD5 |
b21b32b250af0e8251a6cac5168b41c7
|
|
| BLAKE2b-256 |
9397c98c6a920a88128a3f03967bf850bd55f41f67f29f94cb543f08b4fd9245
|