Lints and formats HTML templates with djLint in Zed, through its language server. It works in HTML and in the languages of the template extensions: Django, Jinja2, HTML-Jinja, Twig, Nunjucks, Liquid, Handlebars, Mustache, Tera, Mako, Angular and Go HTML templates.
The extension isn't in Zed's extension registry yet. Until it is, install it as a dev extension, as the djLint docs describe.
It needs djLint 1.49 or newer, and looks for it in this order:
- The
binarysetting below. node_modules/.bin/djlintin the project, whichnpm i -D djlintputs there. The npm package comes with its own Python and runs on thenodeon PATH.djlinton PATH, such as one fromuv tool install, pip, pipx ornpm i -g.- uv, which runs djLint with no install.
Findings appear in these languages as soon as the extension is installed. To format with djLint, make it the formatter of the languages you want:
{ "languages": { "Django": { "formatter": { "language_server": { "name": "djlint" } } } } }To leave a language out, such as plain HTML, turn the server off for it:
{ "languages": { "HTML": { "language_servers": ["!djlint", "..."] } } }djLint reads the project's configuration as usual. Settings from Zed win over it, and are described in the docs of the language server:
{
"lsp": {
"djlint": {
"binary": { "path": "/path/to/djlint", "arguments": ["--lsp"] },
"settings": { "profile": "django", "ignore": ["H013"] }
}
}
}