Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>Nunjucks 11ty PlusNew to Visual Studio Code? Get it now.
Nunjucks 11ty Plus

Nunjucks 11ty Plus

dwkns

|
599 installs
| (0) | Free
Nunjucks syntax highlighting and formatting for 11ty (Eleventy). Supports frontmatter (YAML, JSON, JS), script/style blocks, and HTML.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Nunjucks 11ty Plus

A VS Code extension that adds syntax highlighting, formatting, and a colour theme for Nunjucks templates (.njk), with first-class support for Eleventy (11ty) projects.

License: MIT


Features

Feature Description
Syntax highlighting Nunjucks tags, variables, filters, and embedded HTML in .njk files
Embedded languages JavaScript and CSS in <script> / <style>; YAML, JSON, and JS in frontmatter (---, ---json, ---js)
Format Document Format the whole file (Shift+Alt+F / Shift+Option+F)
Format Selection Format only the selected range via the Command Palette or context menu
Bundled formatters Uses bundled dprint WASM and Prettier — no CLI or local install required
Nunjucks Dark Modern Dark theme based on VS Code Dark Modern with dedicated colours for all Nunjucks scopes

What gets formatted

  • HTML / Nunjucks — dprint markup plugin
  • JavaScript in <script> and ---js frontmatter — dprint
  • JSON in ---json frontmatter — dprint
  • YAML in --- frontmatter — Prettier
  • CSS in <style> blocks — Prettier

Installation

Install from the VS Code Marketplace or from the command line:

code --install-extension dwkns.nunjucks-11ty-plus

Usage

  1. Open a .njk file — VS Code will use the Nunjucks language mode.
  2. Format Document: Shift+Alt+F (Windows/Linux) or Shift+Option+F (macOS).
  3. Format Selection: Select text, right-click, then Format Selection, or use the Command Palette.
  4. Colour theme: File → Preferences → Color Theme → select Nunjucks Dark Modern.
  5. Formatter status: Command Palette → Nunjucks: Show Formatter Info to check that formatters loaded correctly.

Configuration

Setting Default Description
nunjucks.associateHtml false Treat .html files as Nunjucks. When enabled, .html files open with Nunjucks syntax highlighting and formatting.

Customising syntax colours

The extension assigns TextMate scope names (e.g. keyword.control.nunjucks, variable.nunjucks, entity.name.function.filter.nunjucks) to Nunjucks tokens. You can override these in your settings.json via editor.tokenColorCustomizations.

See SYNTAX-SCOPES.md for a complete table of scopes, their colours in the bundled theme, and copy-paste JSON for settings.json.


Requirements

  • VS Code ^1.95.0
  • No extra tools or runtimes — formatters are bundled.

Troubleshooting

  • Formatting fails — Run Nunjucks: Show Formatter Info from the Command Palette. The output channel shows whether dprint plugins loaded. If developing from source, run npm install so node_modules are present.
  • Syntax or formatting looks wrong — File an issue with a small example and your VS Code version.

Contributing

Bug reports and feature requests are welcome on GitHub Issues. Pull requests appreciated — please run npm test before submitting.


License

MIT

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft