A Prettier plugin for formatting AdonisJS Edge templates. Version 1.0.0 actively maintained on GitHub. It formats HTML, Edge tags and interpolations, embedded JavaScript/CSS, and Alpine.js/Livewire attributes in a single pass. Unlike generic formatters, it understands Edge's unique syntax like `@if`, `@each`, `@component`, `@slot`, `@let`, `@include`, `@inject`, `@vite`, `@raw`, `@!card(...)`, and automatically formats JavaScript inside `{{ }}` interpolations. Requires Prettier ^3.0.0 and Node >=18.
npm install prettier-edgeNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to programmatically format an Edge template using prettier-plugin-edge with the Prettier API.
Migrate your project to ESM (type: 'module' in package.json) or use dynamic import(): const prettier = await import('prettier');Do not import it explicitly; install as a devDependency and Prettier auto-detects it for .edge files. For programmatic usage, pass the package name string: plugins: ['prettier-plugin-edge']
Use HTML attribute syntax: x-on:click.prevent instead of @click.prevent, or escape the '@' with \@click.prevent. The plugin attempts to recognize Alpine syntax but may fail with complex event chains.
Keep interpolations short or adjust printWidth. The plugin reduces available width by the indent level, so nested expressions may wrap prematurely.
Run: npm install --save-dev prettier prettier-plugin-edge
Change to ESM (type: 'module' in package.json) or use: const prettier = await import('prettier');Use: const result = await prettier.format(code, options);
Ensure plugin is installed and, if using programmatic API, add plugins: ['prettier-plugin-edge'] to options.