Prettier plugin for formatting Django/Jinja templates and Twig/Melody files. Currently at version 0.5.18 with sporadic releases. It leverages the Melody parser to format .django, .jinja, .html, .twig files, offering Twig-specific options like separate print width, multi-tags, and control over quotes/objects. Unlike general Prettier, it targets template syntax with custom indentation and filter formatting. Supports configuration for non-standard tags and coding standards. Active development, but check GitHub for recent updates.
npm install prettier-plugin-djangoVerified import paths — ran on the pinned version, not inferred.
Installs the plugin, configures prettier with Django-specific options, and formats a simple template.
Add full path to node_modules/prettier-plugin-django in plugins array.
Read plugin options and set desired values in .prettierrc.
Refer to plugin GitHub for updated option names.
Add non-standard tags as paired entries in twigMultiTags array.
Run 'npm install --save-dev prettier-plugin-django' and ensure prettier config has plugins: ['prettier-plugin-django'].
Add overrides in .prettierrc: { "overrides": [ { "files": "*.django", "options": { "parser": "melody" } } ] }Update plugin to latest version; option name is correct.