-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add formatting for HTML templates #985
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good! Would you mind adding an update to the development.md
docs file to just give a quick description of how to install or run pre commit? I think you have to run an init command or something to get it linked with the git repo, is that right?
@caseyhans @rabstejnek - please check this one out and give it a test drive, if we're all ok with how it works, I think we can merge! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice, excited to add this!
Adds formatting for HTML templates via djHTML. Formatting is applied via a pre-commit, and can also be manually applied using
make format-html
.We had to manually update an SVG element which was really long since the formatter allows a maximum length of 10,000 (see the header.html SVG):
HTML allows for line breaks within an attribute; the page appears to render fine on modern browsers.
When using pre-commit, if you try to commit and the validation fails, it will throw an exception and try to format the files properly, but not commit anything automatically. As an example, in this example, I had a badly formatted html template:
It fixes the issue, but leaves the changes unstaged, so I'll need to manually stage and then try to commit again.