black
black copied to clipboard
Support for formatting jinja templates
Given Jinja is a templating language for Python it would be nice if Black could format Jinja templates as well.
Main use case: Formatting the jinja/yaml sls format used by Salt which can get very jinja heavy.
I also have a use case
This also impacts cookiecutter templates for Python projects
I am writing a cookiecutter template and would very much like to use black to format our code. Is any update on this issue?
No update. This is rather low priority for us maintainers. We would love external contributions though!
I think this is out of scope for this project. Jinja is different enough from Python that this is best explored in another tool.
I am writing a cookiecutter template and would very much like to use
blackto format our code. Is any update on this issue?
Hey @alyssweissglass and @ScriptAutomate. We stumbled across the same issue and decided to be pragmatic about it. We are using a post gen hook to format the output of cookiecutter. Obviously, this does not fix the root cause of the issue, but at least we are not creating projects containing invalidly formatted code any more. Also works like a charm with cruft and cruft update in particular.