mjmlio / vscode-mjml

MJML preview, lint, compile for Visual Studio Code.
https://marketplace.visualstudio.com/items?itemName=attilabuti.vscode-mjml
MIT License
172 stars 23 forks source link

Format Document replaces raw <style> with <mj-style> #25

Open Znuff opened 2 years ago

Znuff commented 2 years ago

Description

When using "Format Document" (Shift+Alt+F) in VS Code, <style> tags under <mj-raw> will get converted to <mj-style> tags.

Code sample

<mjml>
  <mj-head>
    <mj-style>
    .main-outside { border: 1px solid red }
    </mj-style>
    <mj-raw>
      <!--[if mso]>
      <style>
      .main-outside { border: none !important }
      </style>
      <![endif]-->
    </mj-raw>
  </mj-head>
</mjml>

This gets Formatted as:

<mjml>
  <mj-head>
    <mj-style>
      .main-outside {
        border: 1px solid red
      }
    </mj-style>
    <mj-raw>
      <!--[if mso]>
      <mj-style>
      .main-outside { border: none !important }
      </mj-style>
      <![endif]-->
    </mj-raw>
  </mj-head>
</mjml>

Specifications

ppozniak commented 2 years ago

Could you check what default formatter you're using? Maybe this could help (vscode settings.json)

  "[mjml]": {
    "editor.defaultFormatter": "mjmlio.vscode-mjml",
  }
Znuff commented 2 years ago

It's already:

    "[mjml]": {
        "editor.defaultFormatter": "mjmlio.vscode-mjml"
    },