NiklasPor / prettier-plugin-go-template

Fixes prettier formatting for go templates 🐹
prettier-plugin-go-template-niklaspor.vercel.app
MIT License
343 stars 24 forks source link

Unintended whitespace is inserted into the value of an HTML attribute #102

Open koyashiro opened 1 year ago

koyashiro commented 1 year ago

When formatting the following HTML, unintended newline and indentation characters (space or tab) are inserted into the value attribute of the input element:

Before

<!DOCTYPE html>
<html lang="en">
  <body>
    {{ $longLongLongLongLongLongLongLongLongNameVariable := true }}
    <input
      type="text"
      value="{{ if $longLongLongLongLongLongLongLongLongNameVariable }}hello{{ end }}"
    />
  </body>
</html>

After

<!DOCTYPE html>
<html lang="en">
  <body>
    {{ $longLongLongLongLongLongLongLongLongNameVariable := true }}
    <input
      type="text"
      value="{{ if $longLongLongLongLongLongLongLongLongNameVariable }}
        hello
      {{ end }}"
    />
  </body>
</html>