How to format nunjucks template files in vscode?

after installing the extension of nunjucks, when you open the template file of nunjucks, you will be prompted that there is no formatter for the nunjucks file when you format the file.
how to format the template file of nunjucks?


you can use the plug-in-Nunjucks, and then set

in settings.json
"files.associations": {
    "*.nj": "nunjucks",
},

if you don't want to use plug-ins, you can set * .nj all so that html, will highlight and format in the style of html

"files.associations": {
    "*.nj": "html",
},

can only check whether there are plug-ins for formatting nunjucks, such as: jkformat


it is recommended to install this plug-in in vscode. It is easy to use

.
Menu