mirror of
https://github.com/Hopiu/djLint.git
synced 2026-03-16 21:40:24 +00:00
updated readme and docs
This commit is contained in:
parent
0ee8d38cdf
commit
aa9097660d
28 changed files with 127 additions and 28 deletions
103
README.md
103
README.md
|
|
@ -1,58 +1,105 @@
|
|||
# 
|
||||
|
||||
Find common formatting issues and *reformat* HTML templates.
|
||||
<h1 align="center">
|
||||
<br>
|
||||
<a href="https://htmlhint.com"><img src="https://raw.githubusercontent.com/Riverside-Healthcare/djLint/master/docs/src/static/img/icon.png" alt="djLint Logo" width="270"></a>
|
||||
<br>
|
||||
</h1>
|
||||
|
||||
<h4 align="center">The missing formatter and linter for HTML templates.</h4>
|
||||
|
||||
***[Django](https://django.readthedocs.io/en/stable/ref/templates/language.html) · [Jinja](https://jinja2docs.readthedocs.io/en/stable/) · [Nunjucks](https://mozilla.github.io/nunjucks/) · [Twig](https://twig.symfony.com) · [Handlebars](https://handlebarsjs.com) · [Mustache](http://mustache.github.io/mustache.5.html) · [GoLang](https://pkg.go.dev/text/template)***
|
||||
<p align="center">
|
||||
<a href="https://codecov.io/gh/Riverside-Healthcare/djlint">
|
||||
<img src="https://codecov.io/gh/Riverside-Healthcare/djlint/branch/master/graph/badge.svg?token=eNTG721BAA" alt="Codecov Status">
|
||||
</a>
|
||||
<a href="https://github.com/Riverside-Healthcare/djlint/actions/workflows/test.yml">
|
||||
<img src="https://github.com/Riverside-Healthcare/djlint/actions/workflows/test.yml/badge.svg" alt="Test Status">
|
||||
</a>
|
||||
<a href="https://www.codacy.com/gh/Riverside-Healthcare/djlint/dashboard?utm_source=github.com&utm_medium=referral&utm_content=Riverside-Healthcare/djlint&utm_campaign=Badge_Grade">
|
||||
<img src="https://app.codacy.com/project/badge/Grade/dba6338b0e7a4de896b45b382574f369" alt="Codacy Status">
|
||||
</a>
|
||||
<a href="https://codeclimate.com/github/Riverside-Healthcare/djlint/maintainability">
|
||||
<img src="https://api.codeclimate.com/v1/badges/5febe4111a36c7e0d2ed/maintainability" alt="Maintainability">
|
||||
</a>
|
||||
<a href="https://pepy.tech/project/djlint">
|
||||
<img src="https://pepy.tech/badge/djlint" alt="Downloads">
|
||||
</a>
|
||||
<a href="https://discord.gg/taghAqebzU">
|
||||
<img src="https://img.shields.io/badge/chat-discord-green" alt="Discord Chat">
|
||||
</a>
|
||||
<a href="https://pypi.org/project/djlint/">
|
||||
<img src="https://img.shields.io/pypi/v/djlint" alt="Pypi Download">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
Ps, ``--check`` it out on other templates as well!
|
||||
<h4 align="center"><a href="https://www.djlint.com">How to use</a> • <a href="https://www.djlint.com/ru/">Как пользоваться</a> • <a href="https://www.djlint.com/fr/">Utilisation</a></h4>
|
||||
<h4 align="center">What lang are you using?</h4>
|
||||
|
||||
[](https://codecov.io/gh/Riverside-Healthcare/djlint) [](https://github.com/Riverside-Healthcare/djlint/actions/workflows/test.yml) [](https://www.codacy.com/gh/Riverside-Healthcare/djlint/dashboard?utm_source=github.com&utm_medium=referral&utm_content=Riverside-Healthcare/djlint&utm_campaign=Badge_Grade) [](https://codeclimate.com/github/Riverside-Healthcare/djlint/maintainability) [](https://pepy.tech/project/djlint)[](https://discord.gg/taghAqebzU) [](https://pypi.org/project/djlint/)
|
||||
<p align="center">
|
||||
<a href="https://djlint.com/docs/languages/django/">Django</a> • <a href="https://djlint.com/docs/languages/jinja/">Jinja</a> • <a href="https://djlint.com/docs/languages/nunjucks/">Nunjucks</a> • <a href="https://djlint.com/docs/languages/twig/">Twig</a> • <a href="https://djlint.com/docs/languages/handlebars/">Handlebars</a> • <a href="https://djlint.com/docs/languages/mustach/">Mustache</a> • <a href="https://djlint.com/docs/languages/golang/">GoLang</a> • <a href="https://djlint.com/docs/languages/angular/">Angular</a>
|
||||
</p>
|
||||
|
||||
## 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 "<div></div>" | 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
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ tool: angular
|
|||
|
||||
{{ description }}
|
||||
|
||||
**[What is Angular?](https://angular.io/guide/template-syntax)**
|
||||
|
||||
#### Using the Command Line
|
||||
|
||||
```bash
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ tool: golang
|
|||
|
||||
{{ description }}
|
||||
|
||||
**[What is GoLang?](https://pkg.go.dev/text/template)**
|
||||
|
||||
#### Using the Command Line
|
||||
|
||||
```bash
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ tool: handlebars
|
|||
|
||||
{{ description }}
|
||||
|
||||
**[What is Handlebars?](https://handlebarsjs.com/)**
|
||||
|
||||
#### Using the Command Line
|
||||
|
||||
```bash
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ tool: jinja
|
|||
|
||||
{{ description }}
|
||||
|
||||
**[What is Jinja?](https://jinja2docs.readthedocs.io/en/stable/)**
|
||||
|
||||
#### Using the Command Line
|
||||
|
||||
```bash
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ tool: handlebars
|
|||
|
||||
{{ description }}
|
||||
|
||||
**[What is Mustache?](http://mustache.github.io/mustache.5.html)**
|
||||
|
||||
#### Using the Command Line
|
||||
|
||||
```bash
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ tool: nunjucks
|
|||
|
||||
{{ description }}
|
||||
|
||||
**[What is Nunjucks?](https://mozilla.github.io/nunjucks/)**
|
||||
|
||||
#### Using the Command Line
|
||||
|
||||
```bash
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ tool: nunjucks
|
|||
|
||||
{{ description }}
|
||||
|
||||
**[What is Twig?](https://twig.symfony.com/)**
|
||||
|
||||
#### Using the Command Line
|
||||
|
||||
```bash
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ tool: angular
|
|||
|
||||
{{ description }}
|
||||
|
||||
**[C'est quoi Angular?](https://angular.io/guide/template-syntax)**
|
||||
|
||||
#### Utilisation de la ligne de commande
|
||||
|
||||
```bash
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ tool: golang
|
|||
|
||||
{{ description }}
|
||||
|
||||
**[C'est quoi GoLang?](https://pkg.go.dev/text/template)**
|
||||
|
||||
#### Utilisation de la ligne de commande
|
||||
|
||||
```bash
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ tool: handlebars
|
|||
|
||||
{{ description }}
|
||||
|
||||
**[C'est quoi Handlebars?](https://handlebarsjs.com/)**
|
||||
|
||||
#### Utilisation de la ligne de commande
|
||||
|
||||
```bash
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ tool: jinja
|
|||
|
||||
{{ description }}
|
||||
|
||||
**[C'est quoi Jinja?](https://jinja2docs.readthedocs.io/en/stable/)**
|
||||
|
||||
#### Utilisation de la ligne de commande
|
||||
|
||||
```bash
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ tool: nunjucks
|
|||
|
||||
{{ description }}
|
||||
|
||||
**[C'est quoi Nunjucks?](https://mozilla.github.io/nunjucks/)**
|
||||
|
||||
#### Utilisation de la ligne de commande
|
||||
|
||||
```bash
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ tool: nunjucks
|
|||
|
||||
{{ description }}
|
||||
|
||||
**[C'est quoi Twig?](https://twig.symfony.com/)**
|
||||
|
||||
#### Utilisation de la ligne de commande
|
||||
|
||||
```bash
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ tool: angular
|
|||
|
||||
{{ description }}
|
||||
|
||||
**[Что такое Angular?](https://angular.io/guide/template-syntax)**
|
||||
|
||||
#### Использование командной строки
|
||||
|
||||
```bash
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ tool: django
|
|||
|
||||
{{ description }}
|
||||
|
||||
**[Что такое Django?](https://django.readthedocs.io/en/stable/ref/templates/language.html)**
|
||||
|
||||
#### Использование командной строки
|
||||
|
||||
```bash
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ tool: golang
|
|||
|
||||
{{ description }}
|
||||
|
||||
**[Что такое GoLang?](https://pkg.go.dev/text/template)**
|
||||
|
||||
#### Использование командной строки
|
||||
|
||||
```bash
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ tool: handlebars
|
|||
|
||||
{{ description }}
|
||||
|
||||
**[Что такое Handlebars?](https://handlebarsjs.com/)**
|
||||
|
||||
#### Использование командной строки
|
||||
|
||||
```bash
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ tool: jinja
|
|||
|
||||
{{ description }}
|
||||
|
||||
**[Что такое Jinja?](https://jinja2docs.readthedocs.io/en/stable/)**
|
||||
|
||||
#### Использование командной строки
|
||||
|
||||
```bash
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ tool: handlebars
|
|||
|
||||
{{ description }}
|
||||
|
||||
**[Что такое Mustache?](http://mustache.github.io/mustache.5.html)**
|
||||
|
||||
#### Использование командной строки
|
||||
|
||||
```bash
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ tool: nunjucks
|
|||
|
||||
{{ description }}
|
||||
|
||||
**[Что такое Nunjucks?](https://mozilla.github.io/nunjucks/)**
|
||||
|
||||
#### Использование командной строки
|
||||
|
||||
```bash
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ tool: nunjucks
|
|||
|
||||
{{ description }}
|
||||
|
||||
**[Что такое Twig?](https://twig.symfony.com/)**
|
||||
|
||||
#### Использование командной строки
|
||||
|
||||
```bash
|
||||
|
|
|
|||
BIN
docs/src/static/img/demo-min.gif
Normal file
BIN
docs/src/static/img/demo-min.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3 MiB |
1
tests/config_gitignore/.gitignore
vendored
Normal file
1
tests/config_gitignore/.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
html_two.html
|
||||
3
tests/config_gitignore/pyproject.toml
Normal file
3
tests/config_gitignore/pyproject.toml
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
[tool]
|
||||
[tool.djlint]
|
||||
use_gitignore=true
|
||||
Loading…
Reference in a new issue