Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Trailing space incorrect behavior #524

Open
2 of 7 tasks
Lutymane opened this issue Oct 25, 2024 · 0 comments
Open
2 of 7 tasks

Bug: Trailing space incorrect behavior #524

Lutymane opened this issue Oct 25, 2024 · 0 comments

Comments

@Lutymane
Copy link

Lutymane commented Oct 25, 2024

Plugin Version

3.2.0

Prettier Version

3.3.3

Which frameworks are affected?

  • none
  • vue
  • angular
  • svelte

Node Version

21.7.2

Which operating systems have you used?

  • Linux
  • macOS
  • Windows

Prettier config

export default {
  plugins: ["@prettier/plugin-pug"],

  htmlWhitespaceSensitivity: "css",
  printWidth: 80,
  arrowParens: "avoid",
  bracketSameLine: false,
  semi: true,
  tabWidth: 2,
  useTabs: false,
  endOfLine: "auto",
  trailingComma: "es5",
  vueIndentScriptAndStyle: false,

  pugAttributeSeparator: "as-needed",
  pugFramework: "vue",
};

Input

h2 Link: 
  a(href="") Click

note trailing space "Link: "

Output or Error

h2 Link:
  |
  a(href="") Click

note trailing space is removed "Link:" and pipe doesn't have it either!

Expected Output

h2 Link:
  | 
  a(href="") Click

//- or perhaps 
h2
  | Link:
  |
  a(href=“”) Click

note trailing space after pipe "| " - the intended behavior

OR

Probably better move the text into child pipe and insert an extra pipe for that space

Additional Context

Prettier alters the result of the template which is not intended. Please look at https://pugjs.org/language/plain-text.html#whitespace-control

Also it doesn't respect htmlWhitespaceSensitivity: "strict" option and still removes any extra whitespace

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant