(unmaintained) VSOT - Like black, but for Django/Jinja2 HTML templates
Note: I recommend looking at the following formatters/indenters instead:
- Full formatting (as VSOT attempts): https://github.com/Riverside-Healthcare/djLint
- Just indentation: https://github.com/rtts/djhtml
HTML Template formatter
Use VSOT to automatically format your django/Jinja2 HTML templates. No need to manually reflow text or tags when you add/remove content.
It has been tested on small files, however there is a lot more to be done an a lot of edge cases which are not handled all that nicely at the moment. Use at your own risk, and only if you have the means to verify the output is correct!
Free software: MIT license
- Mimics black in terms of options and configuration.
- Automatically supports all built in django/jinja2 tags
- Safe - VSOT ensures that it does not change the meaning of the templates
pip install vsot
Requirements: - Python 3.6 or later - Docker - Python poetry (see poetry docs)
- Clone repo
- Installation
poetry install
- A lot of the code for this was repurposed from black
- Antlr4 is used for the parser, along with using the HTML parser from the antlr library as a starting point
- This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.