Skip to content

svelte template pug format remove line break ( and add 2 indent ) #482

@i18nsite

Description

@i18nsite

svelte template pug format remove line break ( and add 2 init indent )

how to add the line break add remove init indent?

❯ cat Test2.svelte
<template lang="pug">
h1(b="1" x="x") 33
+if name
  button(@click=add) Hello {name}
</template>

->

❯ bun x prettier ./Test2.svelte
<template lang="pug">
  h1(b="1" x="x") 33
  +if name
    button(@click=add) Hello {name}</template>

<script lang="coffee">
> svelte > tick

name = 1

add = =>
  ++name
  return
</script>

<style>
button {
  color: #ff3e00;
}
h3 {
  color: #000;
}
</style>

❯ cat ../../package.json
{
  "type": "module",
  "dependencies": {
    "$": "link:../srv/gen/js",
    "@3-/svelte-com": "link:../../i18n/lib/svelte-com",
    "@3-/coffee_plus": "^0.1.15",
    "@3-/jsext": "^0.0.7",
    "@3-/loader": "^0.0.2",
    "svelte": "^5.19.3",
    "vite": "^6.0.11",
    "zx": "^8.3.0"
  },
  "devDependencies": {
    "@prettier/plugin-pug": "^3.2.0",
    "prettier-plugin-svelte": "^3.3.3",
    "prettier-plugin-toml": "^2.0.1"
  }
}
❯ cat ../../.prettierrc.yml
endOfLine: lf
pugAttributeSeparator: none
pugEmptyAttributes: none
pugSortAttributes: asc
svelteAllowShorthand: true
svelteIndentScriptAndStyle: false
svelteSortOrder: options-markup-scripts-styles
plugins:
  - prettier-plugin-svelte
  - "@prettier/plugin-pug"
overrides:
  - files: "*.svelte"
    options:
      parser: svelte

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions