Skip to content

timo-reymann/intellij-mjml-support

Repository files navigation

intellij-mjml-support

CircleCI Version Downloads Rating Renovate Quality Gate Status Reliability Rating FOSSA Status


MJML support for the IntelliJ Platform.

Features

  • Syntax highlighting
  • Inspections for your MJML code
  • Powerful Live-Preview and tooling
  • Autocompletion for color codes, tags, attributes etc.
  • Support for custom MJML components

Requirements

  • IDEA-based IDE compatible with the plugin

Installation

  1. Press (Ctrl+Alt+S/⌘/) to open the IDE settings and select Plugins.
  2. Search for MJML Support in the Marketplace and click Install.

You live on the edge?

There is also the channel snapshot (https://plugins.jetbrains.com/plugins/snapshot/list) available, for more details about set up please see JetBrains Marketplace Docs

The versioning used there is not based on semantic versioning, but rather: YYYY.MM.DD-BUILDNUM and is on

Usage

  • MJML files are automatically picked, you can also find some screenshots in the marketplace.

Motivation

I wanted MJML Support for my beloved JetBrains IDEs.

Contributing

I love your input! I want to make contributing to this project as easy and transparent as possible, whether it's:

  • Reporting a bug
  • Discussing the current state of the configuration
  • Submitting a fix
  • Proposing new features
  • Becoming a maintainer

To get started please read the Contribution Guidelines.

Documentation

Extending plugin functionality with additional plugins

If you want to support custom functionality or resolving maybe specific to the needs your company, there are some entrypoints available.

Custom mjml resolution

You want to add custom mjml tags or custom resolving to match your needs?

Simply use the extension point de.timo_reymann.intellij-mjml-support.tagInformationProvider:

<extensions defaultExtensionNs="de.timo_reymann.intellij-mjml-support">
    <tagInformationProvider implementation="my.company.OurCustomTaginformationProvider"/>
</extensions>

Custom rendering

  • Execution context: parent folder for file to render
  • Input from stdin:
      {
        "directory": "absolute path to project root, this might be different from the current file location",
        "content": "file editor content to render",
        "filePath": "absolute path to file",
        "options": {
          "mjmlConfigPath": "mjml config path or empty string"
        }
      }
  • Output to stdout must be in json in this format for:
      {
        "html": "string|null",
        "errors": [
          {
            "line": "integr|null",
            "message":  "string|null",
            "tagName": "string|null",
            "formattedMessage": "string|null"
          }
        ]
      }
    where errors can be empty, but can never be omitted!

Notes about implementation

  • The preview editor support is adapted from the official markdown plugin
  • Preview uses bundled node_modules for mjml rendering currently, support for custom rendering is currently in development

Architecture Decision Records

For architecture decision records please take a look at docs/adr, this will give you an idea why implementations are as they are.

Development

Requirements

Test

# To run unit tests
./gradlew test

# To run plugin verifier to check compability
./gradlew runPluginVerifier

Build

./gradlew buildPlugin