diff --git a/README.md b/README.md index 30e22ff..dc48f57 100644 --- a/README.md +++ b/README.md @@ -1,58 +1,105 @@ -#  -Find common formatting issues and *reformat* HTML templates. +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Django • Jinja • Nunjucks • Twig • Handlebars • Mustache • GoLang • Angular +
-## Documentation +## 🤔 For What? -Read the [documentation](https://djlint.com) +Once upon a time all the other programming languages had a formatter and linter. Css, javascript, python, the c suite, typescript, ruby, php, go, swift, and you know the others. The cool kids on the block. -## Installation and Usage +HTML templates were left out there on their own, in the cold, unformatted and unlinted :( The dirty corner in your repository. Something had to change. -**djLint** can be installed with `pip install djlint`, and is easy to run: +**djLint is a community build project to and add consistency to html templates.** -```sh -# to lint a directory -djlint /path +## ✨ How? -# to lint a directory with custom extension -djlint /path -e html.dj - -# to check formatting on a file -djlint /path/file.html.j2 --check - -# to reformt a directory without printing the file diff -djlint /path --reformat --quiet - -# using stdin -echo "" | djlint - +Grab it with `pip` +```bash +pip install djlint ``` -## Show your format +Lint your project + +```bash +djlint . --extension=html.j2 --lint +``` +Check your format + +```bash +djlint . --extension=html.j2 --check +``` +Fix my format! +```bash +djlint . --extension=html.j2 --reformat +``` + +## 💙 Like it? Add a badge to your projects ```readme.md```: ```md -[](https://github.com/Riverside-Healthcare/djlint) +[](https://www.djlint.com) ``` Add a badge to your ```readme.rst```: ```rst .. image:: https://img.shields.io/badge/html%20style-djlint-blue.svg - :target: https://github.com/Riverside-Healthcare/djlint + :target: https://www.djlint.com ``` Looks like this: [](https://github.com/Riverside-Healthcare/djlint) -## Contributing +## 🛠️ Can I help? -Send a pr with a new feature, or checkout the [issue](https://github.com/Riverside-Healthcare/djlint/issues) list and help where you can. +Yes! + +*Would you like to add a rule to the linter?* Take a look at the [linter docs](https://djlint.com/docs/linter/) and [source code](https://github.com/Riverside-Healthcare/djLint/blob/master/src/djlint/rules.yaml) + +*Are you a regex pro?* Benchmark and submit a pr with improved regex for the [linter rules]((https://github.com/Riverside-Healthcare/djLint/blob/master/src/djlint/rules.yaml) + +**⚠️ Help Needed! ⚠️** *Good with python?* djLint was an experimental project and is catching on with other devs. Help out with a rewrite of the formatter to improve speed and html style for edge cases. Contribute on the [2.0 branch](https://github.com/Riverside-Healthcare/djLint/tree/block_indent) + +## 🏃 Other Tools Of Note + +* [DjHTML](https://github.com/rtts/djhtml) A pure-Python Django/Jinja template indenter without dependencies. +* [HTMLHint](https://htmlhint.com) Static code analysis tool you need for your HTML +* [curlylint](https://www.curlylint.org) Experimental HTML templates linting for Jinja, Nunjucks, Django templates, Twig, Liquid diff --git a/docs/src/docs/languages/angular.md b/docs/src/docs/languages/angular.md index 27d954a..9eb5bdc 100644 --- a/docs/src/docs/languages/angular.md +++ b/docs/src/docs/languages/angular.md @@ -9,6 +9,8 @@ tool: angular {{ description }} +**[What is Angular?](https://angular.io/guide/template-syntax)** + #### Using the Command Line ```bash diff --git a/docs/src/docs/languages/django.md b/docs/src/docs/languages/django.md index 21ce40c..2c44afe 100644 --- a/docs/src/docs/languages/django.md +++ b/docs/src/docs/languages/django.md @@ -9,6 +9,8 @@ tool: django {{ description }} +**[What is Django?](https://django.readthedocs.io/en/stable/ref/templates/language.html)** + #### Using the Command Line ```bash diff --git a/docs/src/docs/languages/golang.md b/docs/src/docs/languages/golang.md index 1cb44a2..bc72f33 100644 --- a/docs/src/docs/languages/golang.md +++ b/docs/src/docs/languages/golang.md @@ -9,6 +9,8 @@ tool: golang {{ description }} +**[What is GoLang?](https://pkg.go.dev/text/template)** + #### Using the Command Line ```bash diff --git a/docs/src/docs/languages/handlebars.md b/docs/src/docs/languages/handlebars.md index 2437aaf..839bc1e 100644 --- a/docs/src/docs/languages/handlebars.md +++ b/docs/src/docs/languages/handlebars.md @@ -9,6 +9,8 @@ tool: handlebars {{ description }} +**[What is Handlebars?](https://handlebarsjs.com/)** + #### Using the Command Line ```bash diff --git a/docs/src/docs/languages/jinja.md b/docs/src/docs/languages/jinja.md index 8669f75..2b95ea4 100644 --- a/docs/src/docs/languages/jinja.md +++ b/docs/src/docs/languages/jinja.md @@ -9,6 +9,8 @@ tool: jinja {{ description }} +**[What is Jinja?](https://jinja2docs.readthedocs.io/en/stable/)** + #### Using the Command Line ```bash diff --git a/docs/src/docs/languages/mustache.md b/docs/src/docs/languages/mustache.md index 8e856e5..4e262b5 100644 --- a/docs/src/docs/languages/mustache.md +++ b/docs/src/docs/languages/mustache.md @@ -9,6 +9,8 @@ tool: handlebars {{ description }} +**[What is Mustache?](http://mustache.github.io/mustache.5.html)** + #### Using the Command Line ```bash diff --git a/docs/src/docs/languages/nunjucks.md b/docs/src/docs/languages/nunjucks.md index 7f76fa5..43bf952 100644 --- a/docs/src/docs/languages/nunjucks.md +++ b/docs/src/docs/languages/nunjucks.md @@ -9,6 +9,8 @@ tool: nunjucks {{ description }} +**[What is Nunjucks?](https://mozilla.github.io/nunjucks/)** + #### Using the Command Line ```bash diff --git a/docs/src/docs/languages/twig.md b/docs/src/docs/languages/twig.md index ac40a03..cdcd244 100644 --- a/docs/src/docs/languages/twig.md +++ b/docs/src/docs/languages/twig.md @@ -9,6 +9,8 @@ tool: nunjucks {{ description }} +**[What is Twig?](https://twig.symfony.com/)** + #### Using the Command Line ```bash diff --git a/docs/src/fr/docs/languages/angular.md b/docs/src/fr/docs/languages/angular.md index d49a569..0b13dab 100644 --- a/docs/src/fr/docs/languages/angular.md +++ b/docs/src/fr/docs/languages/angular.md @@ -9,6 +9,8 @@ tool: angular {{ description }} +**[C'est quoi Angular?](https://angular.io/guide/template-syntax)** + #### Utilisation de la ligne de commande ```bash diff --git a/docs/src/fr/docs/languages/django.md b/docs/src/fr/docs/languages/django.md index b434a41..246c57d 100644 --- a/docs/src/fr/docs/languages/django.md +++ b/docs/src/fr/docs/languages/django.md @@ -9,6 +9,8 @@ tool: django {{ description }} +**[C'est quoi Django?](https://django.readthedocs.io/en/stable/ref/templates/language.html)** + #### Utilisation de la ligne de commande ```bash diff --git a/docs/src/fr/docs/languages/golang.md b/docs/src/fr/docs/languages/golang.md index c6c1512..967d7e5 100644 --- a/docs/src/fr/docs/languages/golang.md +++ b/docs/src/fr/docs/languages/golang.md @@ -9,6 +9,8 @@ tool: golang {{ description }} +**[C'est quoi GoLang?](https://pkg.go.dev/text/template)** + #### Utilisation de la ligne de commande ```bash diff --git a/docs/src/fr/docs/languages/handlebars.md b/docs/src/fr/docs/languages/handlebars.md index 881fa8a..c72977d 100644 --- a/docs/src/fr/docs/languages/handlebars.md +++ b/docs/src/fr/docs/languages/handlebars.md @@ -9,6 +9,8 @@ tool: handlebars {{ description }} +**[C'est quoi Handlebars?](https://handlebarsjs.com/)** + #### Utilisation de la ligne de commande ```bash diff --git a/docs/src/fr/docs/languages/jinja.md b/docs/src/fr/docs/languages/jinja.md index 77caaed..926be1e 100644 --- a/docs/src/fr/docs/languages/jinja.md +++ b/docs/src/fr/docs/languages/jinja.md @@ -9,6 +9,8 @@ tool: jinja {{ description }} +**[C'est quoi Jinja?](https://jinja2docs.readthedocs.io/en/stable/)** + #### Utilisation de la ligne de commande ```bash diff --git a/docs/src/fr/docs/languages/mustache.md b/docs/src/fr/docs/languages/mustache.md index c17a52d..6e896dc 100644 --- a/docs/src/fr/docs/languages/mustache.md +++ b/docs/src/fr/docs/languages/mustache.md @@ -9,6 +9,8 @@ tool: handlebars {{ description }} +**[C'est quoi Mustache?](http://mustache.github.io/mustache.5.html)** + #### Utilisation de la ligne de commande ```bash diff --git a/docs/src/fr/docs/languages/nunjucks.md b/docs/src/fr/docs/languages/nunjucks.md index 3c607b5..5090fe7 100644 --- a/docs/src/fr/docs/languages/nunjucks.md +++ b/docs/src/fr/docs/languages/nunjucks.md @@ -9,6 +9,8 @@ tool: nunjucks {{ description }} +**[C'est quoi Nunjucks?](https://mozilla.github.io/nunjucks/)** + #### Utilisation de la ligne de commande ```bash diff --git a/docs/src/fr/docs/languages/twig.md b/docs/src/fr/docs/languages/twig.md index 5c26586..fbd032e 100644 --- a/docs/src/fr/docs/languages/twig.md +++ b/docs/src/fr/docs/languages/twig.md @@ -9,6 +9,8 @@ tool: nunjucks {{ description }} +**[C'est quoi Twig?](https://twig.symfony.com/)** + #### Utilisation de la ligne de commande ```bash diff --git a/docs/src/ru/docs/languages/angular.md b/docs/src/ru/docs/languages/angular.md index 343d07e..503b6cd 100644 --- a/docs/src/ru/docs/languages/angular.md +++ b/docs/src/ru/docs/languages/angular.md @@ -9,6 +9,8 @@ tool: angular {{ description }} +**[Что такое Angular?](https://angular.io/guide/template-syntax)** + #### Использование командной строки ```bash diff --git a/docs/src/ru/docs/languages/django.md b/docs/src/ru/docs/languages/django.md index 933de6b..5b3b721 100644 --- a/docs/src/ru/docs/languages/django.md +++ b/docs/src/ru/docs/languages/django.md @@ -9,6 +9,8 @@ tool: django {{ description }} +**[Что такое Django?](https://django.readthedocs.io/en/stable/ref/templates/language.html)** + #### Использование командной строки ```bash diff --git a/docs/src/ru/docs/languages/golang.md b/docs/src/ru/docs/languages/golang.md index f480c30..cb76d80 100644 --- a/docs/src/ru/docs/languages/golang.md +++ b/docs/src/ru/docs/languages/golang.md @@ -9,6 +9,8 @@ tool: golang {{ description }} +**[Что такое GoLang?](https://pkg.go.dev/text/template)** + #### Использование командной строки ```bash diff --git a/docs/src/ru/docs/languages/handlebars.md b/docs/src/ru/docs/languages/handlebars.md index f3877b9..19c61ed 100644 --- a/docs/src/ru/docs/languages/handlebars.md +++ b/docs/src/ru/docs/languages/handlebars.md @@ -9,6 +9,8 @@ tool: handlebars {{ description }} +**[Что такое Handlebars?](https://handlebarsjs.com/)** + #### Использование командной строки ```bash diff --git a/docs/src/ru/docs/languages/jinja.md b/docs/src/ru/docs/languages/jinja.md index fbc9729..39fdd7b 100644 --- a/docs/src/ru/docs/languages/jinja.md +++ b/docs/src/ru/docs/languages/jinja.md @@ -9,6 +9,8 @@ tool: jinja {{ description }} +**[Что такое Jinja?](https://jinja2docs.readthedocs.io/en/stable/)** + #### Использование командной строки ```bash diff --git a/docs/src/ru/docs/languages/mustache.md b/docs/src/ru/docs/languages/mustache.md index 7224788..b0369d7 100644 --- a/docs/src/ru/docs/languages/mustache.md +++ b/docs/src/ru/docs/languages/mustache.md @@ -9,6 +9,8 @@ tool: handlebars {{ description }} +**[Что такое Mustache?](http://mustache.github.io/mustache.5.html)** + #### Использование командной строки ```bash diff --git a/docs/src/ru/docs/languages/nunjucks.md b/docs/src/ru/docs/languages/nunjucks.md index 137c2db..2eba68f 100644 --- a/docs/src/ru/docs/languages/nunjucks.md +++ b/docs/src/ru/docs/languages/nunjucks.md @@ -9,6 +9,8 @@ tool: nunjucks {{ description }} +**[Что такое Nunjucks?](https://mozilla.github.io/nunjucks/)** + #### Использование командной строки ```bash diff --git a/docs/src/ru/docs/languages/twig.md b/docs/src/ru/docs/languages/twig.md index 4672f6b..2ba0fe3 100644 --- a/docs/src/ru/docs/languages/twig.md +++ b/docs/src/ru/docs/languages/twig.md @@ -9,6 +9,8 @@ tool: nunjucks {{ description }} +**[Что такое Twig?](https://twig.symfony.com/)** + #### Использование командной строки ```bash diff --git a/docs/src/static/img/demo-min.gif b/docs/src/static/img/demo-min.gif new file mode 100644 index 0000000..98dff01 Binary files /dev/null and b/docs/src/static/img/demo-min.gif differ diff --git a/tests/config_gitignore/.gitignore b/tests/config_gitignore/.gitignore new file mode 100644 index 0000000..9182828 --- /dev/null +++ b/tests/config_gitignore/.gitignore @@ -0,0 +1 @@ +html_two.html \ No newline at end of file diff --git a/tests/config_gitignore/pyproject.toml b/tests/config_gitignore/pyproject.toml new file mode 100644 index 0000000..ad7ea2f --- /dev/null +++ b/tests/config_gitignore/pyproject.toml @@ -0,0 +1,3 @@ +[tool] +[tool.djlint] +use_gitignore=true \ No newline at end of file