prettier / prettier/plugin-pug

Bug(svelte): the closing </template> tag is moved to the after last word

Open
#468 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

framework: Svelte type: bug
Dominant language
TypeScript
Stars
208
Forks
49
Avg merge
4h 26m
Merged PRs (30d)
8

Description

Info

Tool Version
Plugin v3.0.0
Prettier v3.0.3
Framework svelte 4.2.0
Node v18.16.1
OS mac

Prettier config

{
  "useTabs": false,
  "singleQuote": true,
  "trailingComma": "none",
  "printWidth": 100,
  "plugins": ["@prettier/plugin-pug", "prettier-plugin-svelte"],
  "pluginSearchDirs": ["."],
  "overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }],
  "pugSingleQuote": false,
  "pugSortAttributes": "asc",
  "pugFramework": "svelte"
}

Input

<template lang="pug">
  p digest
</template>

Output

<template lang="pug">
  p digest</template>

Expected Output

<template lang="pug">
  p digest
</template>

Additional Context

At the moment it breaks the styles highlight

image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with the provided Prettier configuration and Svelte template input. Compare the formatter output with the expected output, including the closing tag placement and preserved style highlighting. Done means the closing tag remains on its own line without regressing formatting for the shown case.

Written by the indexing model from the issue text.

Assessment

Tech stack
pug, typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.