CTFd icon indicating copy to clipboard operation
CTFd copied to clipboard

Jinja HTML/Nunjucks linting

Open ColdHeat opened this issue 5 years ago • 7 comments

CTFd makes heavy use of Jinja because of it's origins as a Flask app. Most other code in CTFd is linted and prettified but Jinja doesn't appear to have great open source tools to pull this off. This is to gather resources and knowledge about different approaches that can be used.

ColdHeat avatar Dec 23 '19 03:12 ColdHeat

This problem is basically impossible b/c there doesn't appear to be a reasonable open source tool to lint/prettify Jinja.

ColdHeat avatar Apr 08 '20 00:04 ColdHeat

Kind of impossible to pull this off without spending time figuring out a plugin https://github.com/prettier/prettier/issues/5754

ColdHeat avatar May 15 '20 04:05 ColdHeat

I've found that https://github.com/beautify-web/js-beautify will beautify the HTML but ignore the Jinja syntax. Kind of close.

ColdHeat avatar May 31 '20 04:05 ColdHeat

Another possible solution: https://github.com/thibaudcolas/curlylint

ColdHeat avatar Jun 28 '20 16:06 ColdHeat

This seems to be a problem throughout the Jinja/Django templating world. I haven't found a good solution for this so I am forced to remove it from the milestone. Honestly quite depressing that there's no good open source solution for this.

ColdHeat avatar Jun 29 '20 04:06 ColdHeat

Relevant PR: https://github.com/CTFd/CTFd/pull/1822

ColdHeat avatar Mar 16 '21 16:03 ColdHeat

I found a solution in https://github.com/prettier/prettier/issues/5581#issuecomment-782930909, hope this helps.

iczc avatar Jun 04 '21 04:06 iczc