Skip to content

Commit f41f844

Browse files
committed
improved readme and fixed typos
1 parent 4cc3ff1 commit f41f844

File tree

1 file changed

+21
-15
lines changed

1 file changed

+21
-15
lines changed

README.md

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# parse-server-api-mail-adapter
1+
# parse-server-api-mail-adapter <!-- omit in toc -->
22

33
[![npm version](https://badge.fury.io/js/parse-server-api-mail-adapter.svg)](https://badge.fury.io/js/parse-server-api-mail-adapter)
44
[![build status](https://github.com/mtrezza/parse-server-api-mail-adapter/workflows/ci/badge.svg?branch=main)](https://github.com/mtrezza/parse-server-api-mail-adapter/actions?query=workflow%3Aci+branch%3Amain)
@@ -9,12 +9,14 @@
99

1010
The Parse Server API Mail Adapter enables Parse Server to send emails using any 3rd party API with built-in dynamic templates and localization.
1111

12-
# Content
12+
# Content <!-- omit in toc -->
1313

14-
- [Installation](#Installation)
14+
- [Installation](#installation)
1515
- [Demo](#demo)
1616
- [Configuration](#configuration)
1717
- [Templates](#templates)
18+
- [Placeholders](#placeholders)
19+
- [Password Reset and Email Verification](#password-reset-and-email-verification)
1820
- [Localization](#localization)
1921
- [Need help?](#need-help)
2022

@@ -147,29 +149,33 @@ There are different files for different parts of the email:
147149
- plain-text content (`textPath`)
148150
- HTML content (`htmlPath`)
149151

152+
See the [templates](https://github.com/mtrezza/parse-server-api-mail-adapter/tree/main/spec/templates) for examples how placeholders can be used.
153+
150154
# Placeholders
151-
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.
155+
Placeholders allow to dynamically insert text into the template content. The placeholder values are filled in according to the key-value definitions returned by the placeholder callback in the adapter configuration.
152156

153157
This is using the [mustache](http://mustache.github.io/mustache.5.html) template syntax. The most commonly used tags are:
154158
- `{{double-mustache}}`: The most basic form of tag; inserts text as HTML escaped by default.
155159
- `{{{triple-mustache}}}`: Inserts text with unescaped HTML, which is required to insert a URL for example.
156160

161+
### Password Reset and Email Verification
162+
157163
By default, the following placeholders are available in the password reset and email verification templates:
158-
- `appName`: The app name as defined in the Parse Server configuration.
159-
- `username`: The username of the user who requested the email.
160-
- `link`: The URL to the password reset or email verification form.
164+
- `{{appName}}`: The app name as set in the Parse Server configuration.
165+
- `{{username}}`: The username of the user who requested the email.
166+
- `{{link}}`: The URL to the Parse Server endpoint for password reset or email verification.
161167

162168
# Localization
163169

164170
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.
165171

166-
The locale returned by `localeCallback` will be used to look for locale-specific template files. If the callback return an invalid locale or nothing at all (`undefined`), localization will be ignored and the default files will be used.
172+
The locale returned by `localeCallback` will be used to look for locale-specific template files. If the callback returns an invalid locale or nothing at all (`undefined`), localization will be ignored and the default files will be used.
167173

168174
The locale-specific files are placed in subfolders with the name of either the whole locale (e.g. `de-AT`), or only the language (e.g. `de`). The locale has to be in format `[language]-[country]` as specified in [IETF BCP 47](https://tools.ietf.org/html/bcp47), e.g. `de-AT`.
169175

170176
Localized files are placed in subfolders of the given path, for example:
171-
```
172-
path/
177+
```js
178+
base/
173179
├── example.html // default file
174180
└── de/ // de language folder
175181
│ └── example.html // de localized file
@@ -178,11 +184,11 @@ path/
178184
```
179185

180186
Files are matched with the user locale in the following order:
181-
1. Locale match, e.g. locale `de-AT` matches file in folder `de-AT`.
182-
2. Language match, e.g. locale `de-AT` matches file in folder `de`.
183-
3. Default match: file in base folder is returned.
187+
1. **Locale** (locale `de-AT` matches file in folder `de-AT`)
188+
2. **Language** (locale `de-AT` matches file in folder `de` if there is no file in folder `de-AT`)
189+
3. **Default** (default file in base folder is returned if there is no file in folders `de-AT` and `de`)
184190

185191
# Need help?
186192

187-
- Ask on StackOverflow using the tag [parse-server](https://stackoverflow.com/questions/tagged/parse-server).
188-
- Search through existing issues or open a new issue.
193+
- Ask on StackOverflow using the [parse-server](https://stackoverflow.com/questions/tagged/parse-server) tag.
194+
- Search through existing [issues](https://github.com/mtrezza/parse-server-api-mail-adapter/issues) or open a new issue.

0 commit comments

Comments
 (0)