Skip to content

Commit 6665fbd

Browse files
authored
Merge pull request #3021 from mjmlio/feature/MJML-7-documentation-audit-update
feature/mjml 7 documentation audit update
2 parents 95b9ebd + fe46e1e commit 6665fbd

File tree

47 files changed

+1386
-1366
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1386
-1366
lines changed

doc/basic.md

Lines changed: 118 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,21 @@
11

2-
# Basic layout example
2+
## Basic layout example
33

44
In this section, you're going to learn how to code a basic email template using MJML.
55

6-
Here is the final render we want to end with:
6+
Here‘s what we’re building:
77

8-
<p style="text-align: center;" >
9-
<a href="https://mjml.io/try-it-live/templates/basic"><img width="350px" src="https://static.mailjet.com/mjml-website/documentation/basic-layout-example.png" alt="sexy"></a>
10-
</p>
8+
<figure>
9+
<img width="350px" src="https://static.mailjet.com/mjml-website/documentation/basic-layout-example.png" alt="Basic email layout" />
10+
</figure>
1111

12-
<p style="text-align: center;" >
13-
<a href="https://mjml.io/try-it-live/templates/basic"><img width="100px" src="https://mjml.io/assets/img/svg/TRYITLIVE.svg" alt="try it live" /></a>
14-
</p>
12+
<p class="cta-container"><a class="cta" href="https://mjml.io/try-it-live/templates/basic">Try it live</a></p>
1513

16-
Looks cool, right?
14+
### Sections
1715

18-
## Sections
19-
20-
``` html
16+
```html
2117
<mjml>
2218
<mj-body>
23-
2419
<!-- Company Header -->
2520
<mj-section background-color="#f0f0f0"></mj-section>
2621

@@ -38,167 +33,182 @@ Looks cool, right?
3833

3934
<!-- Social icons -->
4035
<mj-section background-color="#f0f0f0"></mj-section>
41-
4236
</mj-body>
4337
</mjml>
4438
```
45-
First, we will implement the skeleton which are the sections. Here, our email is going to be divided into 6 sections.
4639

47-
## Company Header
40+
First, we’ll create the basic structure, dividing the email into six sections.
4841

49-
``` html
42+
#### Company Header
5043

44+
```html
5145
<!-- Company Header -->
5246
<mj-section background-color="#f0f0f0">
5347
<mj-column>
54-
<mj-text align="center"
55-
font-style="italic"
56-
font-size="20px"
57-
color="#626262">
48+
<mj-text
49+
align="center"
50+
font-style="italic"
51+
font-size="20px"
52+
color="#626262"
53+
>
5854
My Company
5955
</mj-text>
6056
</mj-column>
6157
</mj-section>
62-
6358
```
64-
The first section of the email consists in a centered banner, containing only the company name. The following markup is the MJML representation of the layout we want to obtain.
6559

66-
<aside class="notice">
67-
Remember everything has to be contained in one column.
68-
</aside>
69-
The text padding represents the inner space around the content within the `mj-text` element.
60+
The first section of the email consists in a centered banner, containing only the company name. The following markup is the MJML representation of the layout we want to obtain.
7061

71-
## Image Header
62+
<div class="alert alert-important" role="alert">
63+
<p>Important</p>
64+
<p>Remember everything has to be contained within the column.</p>
65+
</div>
7266

73-
``` html
67+
#### Image Header
7468

69+
```html
7570
<!-- Image Header -->
76-
<mj-section background-url="https://1.bp.blogspot.com/-TPrfhxbYpDY/Uh3Refzk02I/AAAAAAAALw8/5sUJ0UUGYuw/s1600/New+York+in+The+1960's+-+70's+(2).jpg"
77-
background-size="cover"
78-
background-repeat="no-repeat">
79-
80-
<mj-column width="600px">
81-
<mj-text align="center"
82-
color="#fff"
83-
font-size="40px"
84-
font-family="Helvetica Neue">
85-
Slogan here
86-
</mj-text>
87-
88-
<mj-button background-color="#F63A4D"
89-
href="#">
90-
Promotion
91-
</mj-button>
92-
</mj-column>
93-
94-
</mj-section>
71+
<mj-section
72+
background-url="https://1.bp.blogspot.com/-TPrfhxbYpDY/Uh3Refzk02I/AAAAAAAALw8/5sUJ0UUGYuw/s1600/New+York+in+The+1960's+-+70's+(2).jpg"
73+
background-size="cover"
74+
background-repeat="no-repeat"
75+
>
76+
<mj-column width="600px">
77+
<mj-text
78+
align="center"
79+
color="#fff"
80+
font-size="40px"
81+
font-family="Helvetica Neue"
82+
>
83+
Slogan here
84+
</mj-text>
9585

86+
<mj-button background-color="#F63A4D" href="#"> Promotion </mj-button>
87+
</mj-column>
88+
</mj-section>
9689
```
90+
9791
Next comes a section with a background image and a block of text (representing the company slogan) and a button pointing to a page listing all the company promotions.
9892

99-
To add the image header, you will have to replace the section's background-color by a background-url.
100-
Similarly to the first header, you will have to center the text both vertically and horizontally.
101-
The padding remains the same.
102-
The button `href` sets the button location.
103-
In order to have the background rendered full-width in the column, set the column width to 600px with `width="600px"`.
93+
To add the image header, you will have to replace the section's `background-color` with a `background-url`.
10494

105-
## Introduction Text
95+
Similarly to the first company header, you will have to center the text.
96+
97+
The button `href` sets where the button links to.
98+
99+
In order to have the background rendered full-width in the column, set the column width to 600px with `width="600px"`.
106100

107-
``` html
101+
#### Introduction Text
108102

103+
```html
109104
<!-- Intro text -->
110-
<mj-section background-color="#fafafa">
111-
<mj-column width="400px">
112-
<mj-text font-style="italic"
113-
font-size="20px"
114-
font-family="Helvetica Neue"
115-
color="#626262">
116-
My Awesome Text
117-
</mj-text>
118-
<mj-text color="#525252">
119-
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin rutrum enim eget magna efficitur, eu semper augue semper. Aliquam erat volutpat. Cras id dui lectus. Vestibulum sed finibus lectus, sit amet suscipit nibh. Proin nec commodo purus. Sed eget nulla elit. Nulla aliquet mollis faucibus.
120-
</mj-text>
121-
122-
<mj-button background-color="#F45E43"
123-
href="#">
124-
Learn more
125-
</mj-button>
126-
</mj-column>
127-
</mj-section>
105+
<mj-section background-color="#fafafa">
106+
<mj-column width="400px">
107+
<mj-text
108+
font-style="italic"
109+
font-size="20px"
110+
font-family="Helvetica Neue"
111+
color="#626262"
112+
>
113+
My Awesome Text
114+
</mj-text>
128115

129-
```
116+
<mj-text color="#525252">
117+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin rutrum enim
118+
eget magna efficitur, eu semper augue semper. Aliquam erat volutpat. Cras
119+
id dui lectus. Vestibulum sed finibus lectus, sit amet suscipit nibh.
120+
Proin nec commodo purus. Sed eget nulla elit. Nulla aliquet mollis
121+
faucibus.
122+
</mj-text>
130123

131-
The introduction text will consist of a title, a main text and a button.
132-
The title is a regular `mj-text` that can be customized.
124+
<mj-button background-color="#F45E43" href="#">Learn more</mj-button>
125+
</mj-column>
126+
</mj-section>
127+
```
133128

134-
## 2 Columns Section
129+
The introduction text will consist of a heading, the main text and a button.
130+
The title is a regular `mj-text` tag that can be styled as a heading.
135131

136-
``` html
132+
#### 2 Columns Section
137133

134+
```html
138135
<!-- Side image -->
139136
<mj-section background-color="white">
140-
141137
<!-- Left image -->
142138
<mj-column>
143-
<mj-image width="200px"
144-
src="https://designspell.files.wordpress.com/2012/01/sciolino-paris-bw.jpg" />
139+
<mj-image
140+
width="200px"
141+
src="https://designspell.files.wordpress.com/2012/01/sciolino-paris-bw.jpg"
142+
/>
145143
</mj-column>
146144

147145
<!-- right paragraph -->
148146
<mj-column>
149-
<mj-text font-style="italic"
150-
font-size="20px"
151-
font-family="Helvetica Neue"
152-
color="#626262">
153-
Find amazing places
154-
</mj-text>
155-
156-
<mj-text color="#525252">
157-
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin rutrum enim eget magna efficitur, eu semper augue semper. Aliquam erat volutpat. Cras id dui lectus. Vestibulum sed finibus lectus.
158-
</mj-text>
147+
<mj-text
148+
font-style="italic"
149+
font-size="20px"
150+
font-family="Helvetica Neue"
151+
color="#626262"
152+
>
153+
Find amazing places
154+
</mj-text>
159155

156+
<mj-text color="#525252">
157+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin rutrum enim
158+
eget magna efficitur, eu semper augue semper. Aliquam erat volutpat. Cras
159+
id dui lectus. Vestibulum sed finibus lectus.</mj-text
160+
>
160161
</mj-column>
161162
</mj-section>
162-
163163
```
164164

165-
This sections is made up of 2 columns. One containing an image, the other one containing a text.
166-
For the image part, note that when a tag does not have any child, you can use the XML self-closing tag syntax:
167-
`<mj-image />`
165+
This section is made up of two columns. One containing an image, the other containing text.
166+
167+
For the image, note that when a tag does not have any children, you can use the XML self-closing tag syntax: `<mj-image />`
168168

169-
For the text part, you are going to need two `<mj-text>`s like above. One with a title format, and the other one as a regular text.
169+
For the text, you are going to use two `mj-text` tags like, as previously; one with a heading style, and the other one styled as regular text.
170170

171-
## Icons
171+
#### Icons
172172

173-
``` html
173+
```html
174174
<!-- Icons -->
175175
<mj-section background-color="#fbfbfb">
176176
<mj-column>
177-
<mj-image width="100px" src="https://191n.mj.am/img/191n/3s/x0l.png" />
177+
<mj-image
178+
padding="10px"
179+
width="100px"
180+
src="https://191n.mj.am/img/191n/3s/x0l.png"
181+
/>
178182
</mj-column>
179183
<mj-column>
180-
<mj-image width="100px" src="https://191n.mj.am/img/191n/3s/x01.png" />
184+
<mj-image
185+
padding="10px"
186+
width="100px"
187+
src="https://191n.mj.am/img/191n/3s/x01.png"
188+
/>
181189
</mj-column>
182190
<mj-column>
183-
<mj-image width="100px" src="https://191n.mj.am/img/191n/3s/x0s.png" />
191+
<mj-image
192+
padding="10px"
193+
width="100px"
194+
src="https://191n.mj.am/img/191n/3s/x0s.png"
195+
/>
184196
</mj-column>
185197
</mj-section>
186198
```
187-
This section is a 3-columns-based section. Please notice you can make the padding vary to change the space around the images.
199+
This section uses a 3-column layout to display the 3 icons horizontally across the email.
188200

189201

190-
## Social Icons
191-
192-
``` html
202+
#### Social Icons
193203

204+
```html
194205
<mj-section background-color="#e7e7e7">
195206
<mj-column>
196207
<mj-social>
197208
<mj-social-element name="facebook">Share</mj-social-element>
198209
</mj-social>
199210
</mj-column>
200211
</mj-section>
201-
202212
```
203-
The MJML standard components library comes with a `mj-social` component.
204-
Here, we're going to use `facebook` only.
213+
214+
MJML has an `mj-social` component as standard. Here, we're going to use `facebook` only, but there are several default social media sites to choose from, or you can add your own bespoke.

doc/body_components.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
# Standard Body components
1+
## Standard Body components
22

3-
MJML comes out of the box with a set of standard components to help you build easily your first templates without having to reinvent the wheel.
3+
Body components ease your development process by providing ready made responsive layouts that you can use to create your email template.

doc/community-components.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
1-
# Community components
1+
## Community components
22

33
In addition to the standard components available in MJML, our awesome community is contributing by creating their own components.
44

55
To use a community component, proceed as follows:
6+
67
- Install MJML locally with `npm install mjml` in a folder
78
- Install the community component with `npm install {component-name}` in the same folder
8-
- Create a `.mjmlconfig` file in the same folder with:
9+
- Create a `.mjmlconfig` file in the same folder with this code:
910

1011
```json
1112
{
12-
"packages": [
13-
"component-name/path-to-js-file"
14-
]
13+
"packages": ["component-name/path-to-js-file"]
1514
}
1615
```
1716

18-
Finally, you can now use the component in a MJML file, for example `index.mjml`, and run MJML locally in your terminal (make sure to be in the folder where you installed MJML and the community component): `./node_modules/.bin/mjml index.mjml`.
17+
You can now use the component in an MJML file, for example `index.mjml`, and run MJML locally in your terminal. Ensure that you’re in the folder where you installed MJML and the community component, e.g.: `./node_modules/.bin/mjml index.mjml`.

doc/community-contributions.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
## Community Contributions
2+
3+
The MJML ecosystem has a dedicated community that we count to help make it grow and provide it with even more awesome tools, always aiming to make development with MJML an efficient and fun process!
4+
5+
Getting involved is really easy. If you want to contribute, feel free to [open an issue](https://github.com/mjmlio/mjml/issues) or [submit a pull-request](https://github.com/mjmlio/mjml/pulls)!
6+
7+
Here are some tools that utilise MJML:
8+
9+
### Mailjet
10+
11+
[Mailjet](https://www.mailjet.com/demo/) offers an integrated MJML workspace designed for creating, previewing, and managing email templates. Its MJML editor supports syntax highlighting, live preview, and validation, helping you move quickly while keeping your markup in good shape.
12+
13+
The drag-and-drop editor in Mailjet is also built on MJML, so visually created templates share the same responsive structure as those coded by hand.
14+
15+
When your template is ready, you can export it in MJML or HTML, or send emails directly through Mailjet.
16+
17+
### Parcel
18+
19+
[Parcel](https://parcel.io) is the code editor built for email. This feature packed tool includes syntax highlighting, Emmet, inline documentation, autocomplete, live preview, screenshots, and full MJML, CSS, and HTML validation.
20+
21+
Use Focus Mode to keep the preview aligned with the code you're working on, or Inspect Element to easily find the code that produces specific elements in the preview.
22+
23+
Export MJML to HTML with a click.
24+
25+
### IntelliJ IDEA Plugin - MJML Support
26+
27+
[IntelliJ IDEA](https://www.jetbrains.com/idea/) is an IDE developed by JetBrains. The plugin provides you with a (near) realtime preview, auto complete, inline documentation and code analysis.
28+
29+
It is available on the [JetBrains Marketplace](https://plugins.jetbrains.com/plugin/16418-mjml-support).
30+
31+
### Gradle Plugin - MJML Compilation
32+
33+
[Gradle](https://gradle.org/) is a build tool for a various set of languages and environments. The plugin provides an easy way to embed your MJML templates to your Java/Kotlin application in its resources in precompiled form (HTML).
34+
35+
It is available through the gradle plugin system [io.freefair.mjml.java](https://plugins.gradle.org/plugin/io.freefair.mjml.java) and documentation is available here [FreeFair User Guide](https://docs.freefair.io/gradle-plugins/current/reference/).
36+
37+
### Neos CMS
38+
39+
[Neos CMS](https://www.neos.io/) is a content management system that combines structured content with application. This package adds the helper for compiling MJML markup as well as some prototypes which allow you to use TailwindCSS like classes in your MJML markup.
40+
41+
It is available on [packagist](https://packagist.org/packages/garagist/mjml).
42+
43+
### Easy-email
44+
45+
[Easy-email](https://github.com/zalify/easy-email) drag-and-drop email editor based on MJML. Transform structured JSON data into HTML that’s compatible with major email clients.
46+
47+
### Email Love
48+
49+
The [Email Love Figma plugin](https://www.figma.com/community/plugin/1387891288648822744/email-love-html-email-builder) takes the headache out of the email development process by enabling you to export responsive, production-ready email HTML or MJML directly from Figma.

0 commit comments

Comments
 (0)