Skip to content

Format Jinja2 HTML templates with djLint and Prettier

I like to lint and autoformat. For HTML with Jinja2 templating, djlint and prettier are great, but they disagree on some details like long lines. Here's how I've been combining them:

1
2
3
djlint --reformat --profile=jinja index.j2.html || test $? -eq 1
prettier --write index.j2.html
djlint --lint --profile=jinja index.j2.html

Mastodon