Giter VIP home page Giter VIP logo

vscode-mjml's Introduction

This repo is archived

MJML

MJML preview, lint, compile for Visual Studio Code.

GitHub license Visual Studio Marketplace Visual Studio Marketplace installs Dependencies Status

Features

  • Live preview for MJML files. Preview updates as you type. Preview based on html-preview-vscode.
  • Inline errors (squiggle underlines). Linter based on atom-linter-mjml.
  • Export HTML file from MJML.
  • Copy the result HTML to clipboard.
  • Take a screenshot of the rendered MJML document.
  • Send email with Nodemailer or Mailjet.
  • Code snippets for MJML. Based on mjml-syntax.
  • Fetch official templates. Based on mjml-app.
  • Beautify MJML code.
  • Migrate a template from MJML 3 to MJML 4.
  • MJML syntax highlight. Based on mjml-syntax.
  • Built-in MJML documentation with Try it live support.

It looks like this

MJML Preview

MJML Lint

Installation

Press F1, type ext install vscode-mjml.

Usage

Start command palette (with Ctrl+Shift+P or F1) and start typing MJML.

Available commands

The following command is available:

  • MJML: Beautify or Format Document Beautify MJML code.
  • MJML: Copy HTML Copy the result HTML to clipboard.
  • MJML: Export HTML Export HTML file from MJML.
  • MJML: Migrate Migrate a template from MJML 3 to MJML 4.
  • MJML: Multiple Screenshots Take multiple screenshots of the rendered MJML document.
  • MJML: Open Preview to the Side Opens a preview in a column alongside the current document.
  • MJML: Screenshot Take a screenshot of the rendered MJML document, and save it as a file.
  • MJML: Send Email Send email with Nodemailer or Mailjet.
  • MJML: Template Fetch official templates.
  • MJML: Documentation open the MJML documentation.
  • MJML: Search in MJML documentation search for the selected mj-element in the MJML documentation.
  • MJML: Version Shows the version of MJML.

Settings

Name Default Description
mjml.autoPreview false Automatically update preview when switching between MJML documents.
mjml.beautifyHtmlOutput false Beautify HTML output. (Works when mjml.minifyHtmlOutput aren't enabled.)
mjml.beautify Beautify options (available options).
mjml.exportType .html Specifies the file type of the output file.
mjml.lintEnable true Enable/disable MJML linter (requires restart).
mjml.lintWhenTyping true Whether the linter is run on type or on save.
mjml.mailFromName Sender name.
mjml.mailRecipients Comma separated list of recipients email addresses.
mjml.mailSender Sender email address. (Mailjet: must be a verified sender.)
mjml.mailSubject Email subject.
mjml.mailer mailjet Send email with Nodemailer or Mailjet. Possible values are 'nodemailer' and 'mailjet'.
mjml.mailjetAPIKey Mailjet API Key.
mjml.mailjetAPISecret Mailjet API Secret.
mjml.minifyHtmlOutput true Minify HTML output.
mjml.nodemailer {} Nodemailer configuration. Please see the Nodemailer documentation for more information.
mjml.preserveFocus true Preserve focus of Text Editor after preview open.
mjml.screenshotQuality 75 Screenshot quality.
mjml.screenshotType jpg Screenshot type. Possible values are 'png', 'jpg', and 'jpeg'.
mjml.screenshotWidth 650 Screenshot width.
mjml.screenshotWidths 640,750 Screenshot widths.
mjml.updateWhenTyping true Update preview when typing.
mjml.previewBackgroundColor Preview background color.
mjml.autoClosePreview true Automatically close preview when all open MJML documents have been closed.
mjml.showSaveDialog false Show the save as dialog instead of input box.
mjml.templateGallery false Show the template gallery instead of quick pick.
mjml.templateGalleryAutoClose true Automatically close template gallery when selecting a template.

Snippets

Trigger URL Content
mjall mj-all <mj-all />
mjattributes mj-attributes <mj-attributes></mj-attributes>
mjbody mj-body <mj-body></mj-body>
mjbreakpoint mj-breakpoint <mj-breakpoint width="" />
mjbutton mj-button <mj-button></mj-button>
mjcarousel mj-carousel <mj-carousel></mj-carousel>
mjcarousel-image mj-carousel-image <mj-carousel-image src="" />
mjclass mj-class <mj-class name="" />
mjcolumn mj-column <mj-column width=""></mj-column>
mjdivider mj-divider <mj-divider />
mjfont mj-font <mj-font name="" href="" />
mjgroup mj-group <mj-group></mj-group>
mjhead mj-head <mj-head></mj-head>
mjhero mj-hero <mj-hero></mj-hero>
mjimage mj-image <mj-image src="" alt="" />
mjinclude mj-include <mj-include path="" />
mjraw mj-raw <mj-raw></mj-raw>
mjsection mj-section <mj-section></mj-section>
mjsocial mj-social <mj-social></mj-social>
mjsocialelement mj-social-element <mj-social-element></mj-social-element>
mjstyle mj-style <mj-style></mj-style>
mjtable mj-table <mj-table></mj-table>
mjtext mj-text <mj-text></mj-text>
mjtitle mj-title <mj-title></mj-title>
mjml mjml <mjml></mjml>
mjpreview mj-preview <mj-preview></mj-preview>
mjspacer mj-spacer <mj-spacer height="" />
mjwrapper mj-wrapper <mj-wrapper></mj-wrapper>
mjaccordion mj-accordion <mj-accordion></mj-accordion>
mjaccordion-element mj-accordion-element <mj-accordion-element>...</mj-accordion-element>
mjnavbar mj-navbar <mj-navbar></mj-navbar>
mjnavbarlink mj-navbar-link <mj-navbar-link></mj-navbar-link>
mjlink mj-link <mj-link href=""></mj-link>
mjml- Basic MJML Template

Nodemailer configuration

Please see the Nodemailer documentation for more information.

"mjml.nodemailer": {
    "service": "Gmail",
    "auth": {
        "user": "[email protected]",
        "pass": "password"
    }
}
"mjml.nodemailer": {
    "host": "smtp.mailtrap.io",
    "port": 2525,
    "auth": {
        "user": "username",
        "pass": "password"
    }
}
"mjml.nodemailer": {
    "host": "smtp.ethereal.email",
    "port": 587,
    "auth": {
        "user": "[email protected]",
        "pass": "password"
    }
}

Change Log

[1.6.0] (2018-10-28)

  • [new] Configuration property mjml.templateGallery: Show the template gallery instead of quick pick.
  • [new] Configuration property mjml.templateGalleryAutoClose: Automatically close template gallery when selecting a template.
  • #42 #43: fixed beautify issues.
  • [new] #47 MJML: Version: Shows the version of MJML.
  • .mjmlconfig is working again.
  • MJML 4.2.0
  • Other improvements and bugfixes.

[1.5.1] (2018-10-03)

  • #41: fixed preview issue.
  • #40: fixed comment issue.

[1.5.0] (2018-09-28)

  • [new] Configuration property mjml.previewBackgroundColor: preview background color (#39).
  • [new] Configuration property mjml.showSaveDialog: show the save as dialog instead of input box.
  • [new] Configuration property mjml.autoClosePreview: automatically close preview when all open MJML documents have been closed.
  • [new] MJML: Documentation: open the MJML documentation.
  • [new] MJML: Search in MJML documentation: search for the selected mj-element in the MJML documentation.
  • #38: added support for beautify mj-style.
  • #35: show more useful information on error in sending the email.
  • #29: merged pull request.
  • MJML syntax highlight with CSS support.
  • The PreviewManager has been completely rewritten.
  • Built-in MJML documentation with Try it live support.
  • Search in MJML documentation from context menu.
  • MJML 4.1.2
  • Some other improvements.

[1.4.0] (2018-07-14)

  • #30: fixed PhantomJS rebuild issue.
  • #27 #31: fixed rendering issue.
  • MJML 4.1.0
  • Some other improvements.

[1.3.0] (2018-05-15)

  • [new] Configuration property mjml.autoPreview: Automatically update preview when switching between MJML documents.
  • MJML 4.0.5
  • Various fixes and other improvements.

[1.2.1] (2018-04-15)

  • #24: fixed.
  • Dependency updates.

[1.2.0] (2018-03-26)

  • [new] Configuration property mjml.mailer: send email with Nodemailer or Mailjet. Possible values are 'nodemailer' and 'mailjet'.
  • [new] Configuration property mjml.nodemailer: Nodemailer configuration. Please see the Nodemailer documentation for more information.
  • Send email with Nodemailer.
  • Added support for inline images (automatically generated from local images).
  • New preview icon.
  • Some other improvements.
  • MJML 4.0.3

[1.1.0] (2018-03-18)

  • [new] Configuration property mjml.exportType: Specifies the file type of the output file.
  • MJML: Export HTML: allows to specify the exported file type (e.g. example.html or .pug).
  • MJML 4.0.2

[1.0.0] (2018-03-07)

  • [new] MJML: Migrate: Migrate a template from MJML 3 to MJML 4.
  • Change to Semantic Versioning.
  • Some fixes.
  • MJML 4.0.0

[0.1.0] (2017-12-14)

  • [new] MJML: Beautify: #8 Beautify MJML code.
  • #15: fixed preview cache issue.
  • Some other improvements.

[0.0.9] (2017-10-06)

  • [new] Configuration property mjml.screenshotWidths: Screenshot widths.
  • [new] MJML: Multiple Screenshots: #13 Take multiple screenshots of the rendered MJML document.
  • [new] MJML: Template: Fetch official templates from source. Based on mjml-app.
  • Some other small improvements.
  • MJML 3.3.5

[0.0.8] (2017-09-04)

[0.0.7] (2017-07-21)

  • #5: .mjmlconfig is now supported.
  • [new] Configuration property mjml.mailjetAPIKey: Mailjet API Key.
  • [new] Configuration property mjml.mailjetAPISecret: Mailjet API Secret.
  • [new] Configuration property mjml.mailSender: Sender email address. (Mailjet: must be a verified sender.)
  • [new] Configuration property mjml.mailFromName: Sender name.
  • [new] Configuration property mjml.mailSubject: Email subject.
  • [new] Configuration property mjml.mailRecipients: Comma separated list of recipients email addresses.
  • [new] MJML: Copy HTML: Copy the result HTML to clipboard.
  • [new] MJML: Send Email: Send email with Mailjet.
  • Some other small improvements.

[0.0.6] (2017-06-28)

  • Added PhantomJS-rebuild functionallity in order to build PhantomJS for the propper OS. Based on MarkdownConverter.

[0.0.5] (2017-06-28)

  • #3: fixed preview issue.
  • [new] Configuration property mjml.lintWhenTyping: whether the linter is run on type or on save.
  • [new] Configuration property mjml.minifyHtmlOutput: minify HTML output.
  • [new] Configuration property mjml.beautifyHtmlOutput: beautify HTML output. (Works when mjml.minifyHtmlOutput aren't enabled.)
  • [new] Configuration property mjml.screenshotWidth: screenshot width.
  • [new] Configuration property mjml.screenshotType: screenshot type. Possible values are 'png', 'jpg', and 'jpeg'.
  • [new] Configuration property mjml.screenshotQuality: screenshot quality.
  • [new] MJML: Screenshot: Take a screenshot of the rendered MJML document, and save it as a file.
  • Fixed background-url path issue.
  • Lint when a MJML file is opened.
  • Some other small improvements.

[0.0.4] (2017-06-21)

  • #1: fixed image path issue.
  • #2: fixed mj-include issue.
  • [new] Configuration property mjml.preserveFocus: preserve focus of Text Editor after preview open.
  • [new] Configuration property mjml.updateWhenTyping: update preview when typing.
  • MJML: Open Preview was renamed to MJML: Open Preview to the Side
  • MJML: Generate HTML was renamed to MJML: Export HTML
  • MJML 3.3.3

[0.0.2] (2017-05-08)

  • Some fixes.

[0.0.1] (2017-05-07)

  • This is the initial release of this extension.

Issues

Submit the issues if you find any bug or have any suggestion.

Contribution

Fork the repo and submit pull requests.

Contributors

A big thanks to the people that have contributed to this project:

License

This extension is licensed under the MIT License.

vscode-mjml's People

Contributors

attilabuti avatar cbrevik avatar jskrzypek avatar kvnol avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vscode-mjml's Issues

Preview updates when focus changed

Expected behavior

Should preview the select file

Actual behavior

Previews the file where I have last edited something (even when I just insert a single space)

Steps to reproduce the problem

  1. Open a file to includes another
  2. Preview this file
  3. Open the included and edit it

Code sample

Please provide a code snippet.

Screenshot / GIF

https://giphy.com/gifs/1o1irl0FE1KYwrd3vS/html5

Specifications

  • VS Code version: latest
  • MJML extension version: latest
  • Operating system and version: macOS 10.14.1

Other information

List any other information that is relevant to your issue.

Export with different extension

It would be nice if there was the possibility of adding other extensions to the html. For example, export to namefile.html.hbs. The markup would always remain html but with an additional extension so that it can also be used within frameworks.

Don't beautify mj-style

Hi, first of all, great plugin! 👍 The only thing I think were this could improve is when allowing the beautifying is when the mj-style is used.

Currently it formats every class and styling on one line which is not handy to work with. The wanted behavior should be like how it beautifies CSS.

What do you think?

Question: MJML couldn't build the propper version of PhantomJS

Just installed a new machine (macOS - 1.13.4) with vscode (1.23.1) with the mjml extension (1.3.0) which basically results in the following:

MJML couldn't build the propper version of PhantomJS. Restart VSCode in order to try it again.

Followed by:

MJML needs to be rebuilt for your current platform. Please wait for the installation to finish...

As its mentioned that there are no dependencies I wonder whats missing here?

Linting Error

Pertains to latest version: 1.4

Linter is displaying error "Attribute line-height has invalid value: 1.2 for type Unit, only accepts (px, %) units and 1 value(s)" when error does not exist.

Sample occurrence: a line that has commented code i.e. having error message displayed. Sample occurrence has nothing to do an attribute of line-height.

When commented code is deleted and following line moved up, error is then displayed for that line, even though following line does not have line-height as an eligible attribute.

<mjml> <mj-head> <mj-breakpoint width="600px" /> <mj-preview></mj-preview> <!--styles--> (error displayed on this line) <mj-include path="../../components/styles.mjml" /> <!--fonts--> <mj-include path="../../components/fonts.mjml" /> <mj-attributes> <!--attributes--> <mj-include path="../../components/attributes.mjml" /> </mj-attributes> </mj-head> <mj-body>

Html highlighting and tag autocompletion

Is it possible to have html support in mjml file? Like html tags highlighting or creating <div></div> by having just div written and pressing tab like in html files? I tried

"files.associations": {
  "*.mjml": "html"
}

but then this plugin doesn't work anymore.

Preview not showing Images

Hi Attila,

When I use the Preview extension, the images are missing. I can take a screenshot without changing anything and see the images. I can also open the html in my browser and see the images. Is there a setting I need to change?

Preview to the side freezes

Hi, first of all, thanks for the awesome package :)

So, when i have the preview to the side opened it freezes often and I have to close and reopen the project to un-freeze it.

I've observed that this happens usually when changing the src property of <mj-image> tags and when some syntax errors are detected. Sometimes it fixes by waiting 1 or 2 minutes, but opening and closing the project works every time.

Specifications

  • VS Code version: 1.29.1
  • MJML extension version: 1.6.0
  • Operating system and version: macOS Mojave 10.14.1

Beautify document deletes file content

Hello,

when I use the MJML: beautify Command on my file the whole file content gets removed.
Haven't had this issue when I used the extension about two months ago.

I'm trying to find some debug output to provide more information, but can't find any.
When I change the language type of the file to html the formatting works just fine.

Any ideas? Maybe some misconfiguration in my settings?

Code linting not working

My Environment:

  • Windows 10
  • Visual Studio Code 1.19.1
  • mjml installed globally

Update:
Seems like its working partially, attaching the screenshot of markup.

Improper nesting of section is marked but ending tag for body & mjml not marked

linting

problem with linter and code colors

The really good extension, but 2 problems

1- linter <mg-include> and <mj-social> have errors
<mg-include>: when I use it inside mg-body or container error occurs while it's not really an error
<mj-social>: when I use custom social networks like my-awesome-network error occurs while its working well in output html

2- I don't know why but code colors don't appear / it treats my code as plain text

Sending email

Hi,

How do you send email? I tried to set the email and password but it still gets an error. No particular error message, just "Something went wrong"

image

Special characters are not rendering when HTML is copied

Expected behavior

When you export the MJML from VSC, special characters, such as an m-dash "—", should display properly.

Actual behavior

When the HTML is copied, it is converting the m-dash to —. Other symbols have been getting converted to gibberish as well.

Originally, VSC was in windows 1252 so I thought that the encoding was the problem but it is still persisting even after I have converted to UTF-8.

If I export copy the HTML from the exact same file via the MJML desktop app, then all the HTML is good and symbols display correctly.

Update: Exporting now works. Must have been an issue with exporting in Windows 1252. Copying the HTML is still not working.

Steps to reproduce the problem

  1. Write MJML in VSC as normal and use special characters, like m-dashes (not the &mdash; but using the actual "—" character)
  2. Copy the code
  3. Paste the HTML into ESP or editor and the symbols will be encoded differently.

Code sample

<mj-text padding-top="0">
    <p>This is some content about nothing—but it is about something.</p>
</mj-text>

Specifications

  • VS Code version: 1.29.1
  • MJML extension version: 1.6.0
  • Operating system and version: macOS Mojave v10.14

Other information

Not sure if there is a setting in VSC to address this or if it is an issue with the way the HTML is being compiled but I've tried updating all the encoding settings I can find to make sure UTF-8 is used but can't figure out why the MJML desktop apps works and VSC doesn't. My only thought is there is an encoding issue when the HTML is compiled.

Does this not support includes?

This seems not to work when an email broken up with includes? Works fine when i manually bring it all together. am i missing a setting or function i need to perform first? tnx

Old previews are cached and new ones does not show

mjml extension: 0.0.9
vscode:
Version 1.17.2
Commit b813d12980308015bcd2b3a2f6efa5c810c33ba5
Date 2017-10-16T13:57:00.652Z
Shell 1.7.7
Renderer 58.0.3029.110
Node 7.9.0
Architecture x64

OS: Linux

When I open a.mjml and preview it, everything is ok, then I open file b.mjml and when I preview it, the extension still shows a.mjml content

Feature Request/Question: How to add custom components to vscode-mjml?

Before you open an issue, please check if a similar issue already exists or has been closed before.

Expected behavior

Follow custom component tutorial per https://medium.com/mjml-making-responsive-email-easy/tutorial-creating-your-own-component-with-mjml-4-1c0e84e97b36

Load index.mjml

Expect custom components work in vscode with mjml plug-in

FYI. I'm fine if there is a registration step to get this to work. Ideally, it shouldn't be necessary to rebuild and reinstall the plug-in.

Actual behavior

mj-basic-component, mj-image-text and mj-layout all report errors.

Screenshot / GIF

Please attach screenshot/gif if you consider them as helpful to understand/reproduce the issue.
image

Specifications

  • VS Code version: 1.30.2
  • MJML extension version: 4.2.0
  • Operating system and version: Mac OS

Supporting component preview/rendering in this extension

I'm trying to develop some components to use with MJML.

I've tried cloning the following example project: https://github.com/mjmlio/mjml-component-boilerplate

When following the instructions, the custom component will not render in the extension preview, nor is it rendered with the HTML which is generated with this extension.

It is rendered in the HTML generated by the Gulp-script in that project though.

Does this extension inspect the .mjmlconfig which defines the component? Or is it some other issue?

From VSCode:
image

<mj-include> syntax problem

Awesome extension, thanks so much for you work!

I'm not sure if it is related to #2, but using 0.0.6 I'm getting the following error using <mj-include>:
image

It's only a syntax error inside VSCode though, the included file is still rendering inside Preview & exported as HTML.

mj-include fails both linting and preview

When using a <mj-include path="templates/shared/header.mjml" /> tag, I get a linting warning.

screenshot

The preview also fail to show the included content, without errors or warnings.

When running the template through the CLI (and through the mjml2html JS module), the output is generated as expected and without warnings.

I'm using version 0.0.9 of the extension, and version 1.18.1 of VS Code on Windows.

Extension not working in latest version of vscode

Updated to the lastest version of vscode 1.14.0 and now MJML doesn't work anymore. It won't detect mjml files and it isn't doing any syntax highlighting.

All of the other options simply do nothing.

Stripping out template tags

Hey @attilabuti,

First off thanks for such an incredible extension, only just started working with mjml and your extension makes the developer experience unreal!!

I'm trying to render my mjml templates to .hbs files for handlebars but unfortunately the loops opening and closing tags are getting stripped out. For example...

{#each posts}
  <mj-section>
    <mj-column width="75%">
      <mj-text>
        <h3><a href="{link}">{title}</a></h3>
        {{excerpt}}
      </mj-text>
    </mj-column>
    <mj-column width="25%">
      <mj-image width="100px" href="{link}" src="{imageUrl}"></mj-image>
    </mj-column>
  </mj-section>
{/each}

{#each posts} and {/each} at the end get removed from the compiled markup but the other template tags in the middle render correctly.

Any ideas on how to fix it?

Thanks

Comment with HTML-style comments?

Hi Attila!

Quick question - when I use the Command + / shortcut to comment a line or selection, it is currently only putting // at the start of the line, instead of using HTML comment syntax <!-- -->. Is this standard/expected behaviour, or do I possibly have something configured wrong in my VS Code settings?

<mj-include>'s are ignored

Super grateful for your work on this extension, as it brings better MJML functionality to my favorite editor.

Not sure if this is a feature request or a bug, but .mjml files imported using <mj-include> do not render in the preview window, nor are they included when exporting to HTML.

Trying to componentize my templates, but swapping out my preheader and header/nav sections with

<mj-include path="./preheader" />
<mj-include path="./header" />

results in a preview without either. Exporting to HTML does not include them either, they're just skipped. The linter doesn't recognize mj-include elements. Putting the includes in the same folder or a subfolder, including or omitting the file extension, makes no difference.

This functionality works in the MJML desktop app v2.4.0 running MJML v3.3.3

I am running extension v0.0.2 and VS code 1.13.1 on Windows 10 Creators Update.

the preview don't work

Hi,
The preview don't work , with mjml file i have no message to this code :





Hello World!




with the html file i have the message "Active editor doesn't show a MJML document."

MJML 4

Hi,
when will there be support for MJML 4 version? 😄

No syntax highlighting in VSCode 1.14.2 ?

I installed the extension in VSCode 1.14.2.

Lots works... red squiggly line linting works.

The screenshot and live preview works.

But there's no syntax highlighting, everything is just plain text.

I disabled all other extensions except this one, didn't help.

mj-table translates incorrectly

If I take the following markup

<mjml>
  <mj-body>
    <mj-section>
      <mj-column>
        <mj-table>
          <thead>
            <tr style="border-bottom:1px solid #ecedee;text-align:left;padding:15px 0;">
              <th style="padding: 0 15px 0 0;">Year</th>
              <th style="padding: 0 15px;">Language</th>
              <th style="padding: 0 0 0 15px;">Inspired from</th>
            </tr>
          </thead>
          <tfoot>
            <tr>
              <td style="padding: 0 15px 0 0;">1995</td>
              <td style="padding: 0 15px;">PHP</td>
              <td style="padding: 0 0 0 15px;">C, Shell Unix</td>
            </tr>
          </tfoot>
          <tbody>
            <tr>
              <td style="padding: 0 15px 0 0;">1995</td>
              <td style="padding: 0 15px;">JavaScript</td>
              <td style="padding: 0 0 0 15px;">Scheme, Self</td>
            </tr>
          </tbody>
        </mj-table>
      </mj-column>
    </mj-section>
  </mj-body>
</mjml>

mjml.io translates this to HTML differently than this plugin.

Using mjml.io, I get

<table 0="[object Object]" 1="[object Object]" 2="[object Object]" border="0" style="cellspacing:0;color:#000;font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:22px;table-layout:auto;width:100%;">
        <thead>
            <tr style="border-bottom:1px solid #ecedee;text-align:left;padding:15px 0;">
              <th style="padding: 0 15px 0 0;">Year</th>
              <th style="padding: 0 15px;">Language</th>
              <th style="padding: 0 0 0 15px;">Inspired from</th>
            </tr>
          </thead>
          <tfoot>
            <tr>
              <td style="padding: 0 15px 0 0;">1995</td>
              <td style="padding: 0 15px;">PHP</td>
              <td style="padding: 0 0 0 15px;">C, Shell Unix</td>
            </tr>
          </tfoot>
          <tbody>
            <tr>
              <td style="padding: 0 15px 0 0;">1995</td>
              <td style="padding: 0 15px;">JavaScript</td>
              <td style="padding: 0 0 0 15px;">Scheme, Self</td>
            </tr>
          </tbody>
      </table>

Using vscode-mjml, I get

<table align="center" border="0" cellpadding="0" cellspacing="0" role="presentation" style="width:100%;">
  <tbody>
    <tr>
      <td style="direction:ltr;font-size:0px;padding:20px 0;text-align:center;vertical-align:top;">
        <!--[if mso | IE]><table role="presentation" border="0" cellpadding="0" cellspacing="0"><tr><td class="" style="vertical-align:top;width:600px;" ><![endif]-->
        <div class="mj-column-per-100 outlook-group-fix" style="font-size:13px;text-align:left;direction:ltr;display:inline-block;vertical-align:top;width:100%;">
          <table border="0" cellpadding="0" cellspacing="0" role="presentation" style="vertical-align:top;" width="100%">
            <tr>
              <td align="left" style="font-size:0px;padding:10px 25px;word-break:break-word;">
                <table cellpadding="0" cellspacing="0" width="100%" border="0" style="cellspacing:0;color:#000000;font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:22px;table-layout:auto;width:100%;">
                  <thead>
                    <tr style="border-bottom:1px solid #ecedee;text-align:left;padding:15px 0;">
                      <th style="padding: 0 15px 0 0;">Year</th>
                      <th style="padding: 0 15px;">Language</th>
                      <th style="padding: 0 0 0 15px;">Inspired from</th>
                    </tr>
                  </thead>
                </table>
              </td>
            </tr>
          </table>
        </div>
      </td>
    </tr>
  </tbody>
  <tfoot>
    <tr>
      <td style="padding: 0 15px 0 0;">1995</td>
      <td style="padding: 0 15px;">PHP</td>
      <td style="padding: 0 0 0 15px;">C, Shell Unix</td>
    </tr>
  </tfoot>
  <tr>
    <td style="padding: 0 15px 0 0;">1995</td>
    <td style="padding: 0 15px;">JavaScript</td>
    <td style="padding: 0 0 0 15px;">Scheme, Self</td>
  </tr>
</table>

Notice that the tbody tag disappears from the last element. But more importantly, the thead wraps itself inside of two table elements.

Beautify replaces all styles with mj-styles

When running beautify, my styles.mjml file include in the head is replace with mj-styles.mjml

Before beautify:

<mjml> <mj-head> <mj-breakpoint width="600px" /> <mj-preview></mj-preview> **<!--styles--> <mj-include path="../../components/styles.mjml" />** <!--fonts--> <mj-include path="../../components/fonts.mjml" /> <mj-attributes> <!--attributes--> <mj-include path="../../components/attributes.mjml" /> </mj-attributes> </mj-head>

After beautify:

<mjml> <mj-head> <mj-breakpoint width="600px" /> <mj-preview></mj-preview> **<!--mj-styles--> <mj-include path="../../components/mj-styles.mjml" />** <!--fonts--> <mj-include path="../../components/fonts.mjml" /> <mj-attributes> <!--attributes--> <mj-include path="../../components/attributes.mjml" /> </mj-attributes> </mj-head>

Updated to new VS Code

Hi,

I updated to latest VS Code and now when running the preview I get 'Running the contributed command:'mjml.previewToSide' failed', and the export html is working intermittently?

Language mode creates incompatibility with formatting tools

In order for the plugin to register a document as mjml, the language mode must match. This doesn't let me tweak the file associations to use built in beautification tools because it needs to recognize html. I'm looking to format the source, not the output.

Is there a workaround for this?

Update Preview with current active document?

Hi Attila!

If I have multiple MJML files in my VS Code project, and I switch between them, the preview window will only show the preview for the first document it was opened for. It also won't update to show the preview for subsequent documents, even if I re-run the "Preview to Side" command. The only workaround seems to be closing the preview window, and running the preview command again on the other document.

Is it possible to update the preview window after switching documents to show the current active document, similar to the way the MJML desktop app functions?

Thanks!

Preview hangs when editing mj-attributes

I often use the <mj-attributes> tag to set common styles for things like text size & color, buttons, etc.

If I have the MJML preview pane open, it works fine and updates live as long as I'm editing within the <mj-body> tag. But as soon as I edit anything inside of the <mj-attributes> tag, the preview stops updating and my CPU usage spikes to 100%. The only way to get it to work again is to quit and relaunch VS Code (if I simply close the preview pane without quitting VS Code, it won't reopen again).

I know that the code changes I'm making within the <mj-attributes> tag are valid MJML, because they'll appear in the preview after I quit and relaunch VS Code. So it's not tripping up on invalid syntax or something like that.

I'm running:

  • VS Code 1.28.2
  • vscode-mjml 1.5.1
  • macOS 10.14

This happened to me on earlier versions of VS Code and macOS as well, but I didn't figure out that it was the <mj-attributes> in particular that was causing the issue until now.

Feature Request/Question: Allow to lock the preview to a file

Great plugin, thanks!

I'd like to see one feature: I do use includes to structure my mjml files, and more often than not, they don't preview well or at all. No surprise.

What I would like to do is lock the preview to a master-file (which has the ), and then go and edit the include-file. And watch the effects of changes in the include-file on the master-file.

As it works now, I go the the include, make changes, go back to the master, see what my changes did, go back to the include ...

Thanks for considering such a feature. I can live without, or find a different workflow, but that would add a level of comfort.

export and preview fails since update to 0.0.8

Everything worked like a charm, but a few minutes ago, I guess when it updated to 0.0.8, exporting and previewing fails.

when trying to export I get the error:
"MJMLError: Failed to parse file test.mjml"

when previewing:
"Active editor doesn't show a MJML document."

Tried re-installing the extension, and waited for the "rebuild finished" confirmation, then restarted VSCode.

Please avoid node dependency to "natives" module

Hi,

I am a developer on VSCode and wanted to reach out to inform you that this extension is either using or having a dependency to a node module "natives" that will soon no longer be supported in VSCode once we updated to node.js 8.x (as part of our Electron 2.0 update which is planned for the near term).

The full graph is:

It would be great if this dependency could be avoided by either not depending on it anymore or updating the dependencies to newer versions so that this module is no longer pulled in.

As soon as any code in your extension (including node_modules) calls require("natives") we will throw an exception to prevent this module from getting loaded.

More details in microsoft/vscode#47569

Thanks!
Ben
VSCode Team

Preview not updating when typing

Side preview won't update when typing. Using default settings (on the extension package.json file mjml.updateWhenTyping is set to true).

jun-26-2017 01-14-14

Am I missing something? Great extension, thanks!

Extension version: [0.0.4] (2017-05-21)
OS: macOS 10.12.5
Visual Studio Code 1.13.1

When exporting MJML to HTML, nav icons generated incomplete HTML decimal code

Issue appears in version 1.6.0.

When exporting MJML to HTML that uses navbar, nav icons generated are incomplete HTML decimal code.

Where the hamburger icon was formerly generated, incomplete HTML decimal is generated: 9776.

Where the close icon was formerly generated, incomplete HTML decimal is generated: 8855.

Screenshot problem

After updating to version 1.6.0 I have problems with the Screenshots.

E.g. the following template will result in a complete gray screenshot (default width is 650px):

<mjml>
  <mj-body background-color="gray">
    <mj-section>
      <mj-column>
        <mj-table>
          <tr>
            <td>&bull;</td>
            <td>Test - 1</td>
          </tr>
          <tr>
            <td>&bull;</td>
            <td>Test - 2</td>
          </tr>
        </mj-table>
      </mj-column>
    </mj-section>
  </mj-body>
</mjml>

test

When doing a multipel screenshot with 320/650/1024 only the 320er screenshot is empty. The 650 and 1024 screenshot contains data:
test_650

Any idea what could be wrong here?

Preview Pane Background color is not white

When I activate the preview pane, it has the same background color as the main VS Code. Is there a way to change this? In all product shots it looks white but I just installed it and it looks with the same gray background as Code

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.