jinja2 code formatting

It would be nice to have some formatting options for jinja2/html code.

The syntax is properly highlighted, but formatting is completely left at the whim of the user, and "reformatting" does nothing.

When I share code with people in my team we usually reformat all code before committing so to have a consistent style. It works for python code, for js code, for HTML code... but not for our templates.

We do it by hand, more or less. But we humans are fallible. :(

Is there a way to tell pycharm to reformat jinja2 files as HTML while respecting/highlighting the template tags?

Thanks and regards.
3 comments
Comment actions Permalink
Hi Ivan, formatting of jinja2 templates works in PyCharm. Do you have jinja2 selected as template language on the Template Languages settings page (http://www.jetbrains.com/pycharm/webhelp/template-languages.html)?
1
Comment actions Permalink
I have this problem as well. Here's an example of switching between Django and Jinja templates: http://cl.ly/image/0T2a2V0X1H2F

This is in Professional 4.0.5. Any thoughts?
0
Comment actions Permalink
Actually, this may have been fixed by the latest RC. If so, apologies!
0

Please sign in to leave a comment.