Skip to content

Commit 402a198

Browse files
committed
some minor readme improvements
1 parent 8a1d3e2 commit 402a198

File tree

1 file changed

+34
-13
lines changed

1 file changed

+34
-13
lines changed

README.md

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ The Parse Server API Mail Adapter enables Parse Server to send emails using any
77

88
# Content
99

10-
- [Getting Started](#getting-started)
10+
- [Installation](#Installation)
1111
- [Demo](#demo)
1212
- [Configuration](#configuration)
1313
- [Templates](#templates)
1414
- [Localization](#localization)
1515
- [Need help?](#need-help)
1616

17-
# Getting Started
17+
# Installation
1818

1919
1. Install adapter:
2020
```
@@ -61,38 +61,48 @@ const server = new ParseServer({
6161
sender: '[email protected]',
6262
// The email templates.
6363
templates: {
64-
// The template used by Parse Server to send an email for password reset; this is a reserved template name.
64+
// The template used by Parse Server to send an email for password
65+
// reset; this is a reserved template name.
6566
passwordResetEmail: {
6667
subjectPath: './files/password_reset_email_subject.txt'),
6768
textPath: './files/password_reset_email.txt'),
6869
htmlPath: './files/password_reset_email.html')
6970
},
70-
// The template used by Parse Server to send an email for email address verification; this is a reserved template name.
71+
// The template used by Parse Server to send an email for email
72+
// address verification; this is a reserved template name.
7173
verificationEmail: {
7274
subjectPath: './files/verification_email_subject.txt'),
7375
textPath: './files/verification_email.txt'),
7476
htmlPath: './files/verification_email.html')
7577
},
76-
// A custom email template that can be used when sending emails from Cloud Code; the template name can be choosen freely; it is possible to add various custom templates.
78+
// A custom email template that can be used when sending emails
79+
// from Cloud Code; the template name can be choosen freely; it
80+
// is possible to add various custom templates.
7781
customEmail: {
7882
subjectPath: './files/custom_email_subject.txt'),
7983
textPath: './files/custom_email.txt'),
8084
htmlPath: './files/custom_email.html'),
81-
// Placeholders contain the values to be filled into the placeholder keys in the file content. A placeholder `{{appName}}` in the email will be replaced the value defined here.
85+
// Placeholders are filled into the template file contents.
86+
// For example, the placeholder `{{appName}}` in the email
87+
// will be replaced the value defined here.
8288
placeholders: {
8389
appName: "ExampleApp"
8490
},
85-
// Extras to add to the email payload that is accessible in the `apiCallback`.
91+
// Extras to add to the email payload that is accessible in the
92+
// `apiCallback`.
8693
extra: {
8794
replyTo: '[email protected]'
8895
},
89-
// A callback that makes the Parse User accessible and allows to return user-customized placeholders that will override the default template placeholders.
96+
// A callback that makes the Parse User accessible and allows
97+
// to return user-customized placeholders that will override
98+
// the default template placeholders.
9099
placeholderCallback: async (user) => {
91100
return {
92101
phone: user.get('phone')
93102
};
94103
},
95-
// A callback that makes the Parse User accessible and allows to return the locale of the user for template localization.
104+
// A callback that makes the Parse User accessible and allows
105+
// to return the locale of the user for template localization.
96106
localeCallback: async (user) => {
97107
return user.get('locale');
98108
}
@@ -112,7 +122,7 @@ const server = new ParseServer({
112122
});
113123
```
114124

115-
## Templates
125+
# Templates
116126

117127
Emails are composed using templates. A template defines the paths to its content files, for example:
118128

@@ -131,6 +141,17 @@ There are different files for different parts of the email:
131141
- plain-text content (`textPath`)
132142
- HTML content (`htmlPath`)
133143

144+
# Placeholders
145+
Placeholders allow to dynamically insert text into the template file content. The placeholders are filled in according to the key-value definitions returned by the placeholder callback in the adapter configuration.
146+
147+
This is using the [mustache](http://mustache.github.io/mustache.5.html) template syntax. The most commonly used tags are:
148+
- `{{double-mustache}}`
149+
150+
The most basic form of tag; inserts text as HTML escaped by default.
151+
- `{{{triple-mustache}}}`
152+
153+
Inserts text with unescaped HTML, which is required to insert a URL for example.
154+
134155
# Localization
135156

136157
Localization allows to use a specific template depending on the user locale. To turn on localization for a template, add a `localeCallback` to the template configuration.
@@ -147,7 +168,7 @@ path/
147168
│ └── example.html // de localized file
148169
└── de-AT/ // de-AT locale folder
149170
│ └── example.html // de-AT localized file
150-
````
171+
```
151172

152173
Files are matched with the user locale in the following order:
153174
1. Locale match, e.g. locale `de-AT` matches file in folder `de-AT`.
@@ -156,5 +177,5 @@ Files are matched with the user locale in the following order:
156177

157178
# Need help?
158179

159-
- Search through existing issues or open a new issue.
160-
- Ask on StackOverflow using the tag `parse-server` and `api-mail-adapter`.
180+
- Ask on StackOverflow using the tag [parse-server](https://stackoverflow.com/questions/tagged/parse-server).
181+
- Search through existing issues or open a new issue.

0 commit comments

Comments
 (0)