@maizzle/framework 5.0.0-beta.12 → 5.0.0-beta.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/generators/render.js +1 -4
- package/src/transformers/addAttributes.js +1 -1
- package/src/transformers/comb.js +1 -1
- package/src/transformers/index.js +23 -44
- package/src/transformers/inline.js +2 -1
- package/src/transformers/minify.js +2 -1
- package/src/transformers/replaceStrings.js +3 -1
- package/types/build.d.ts +1 -22
- package/types/config.d.ts +4 -17
- package/types/events.d.ts +4 -185
- package/types/urlParameters.d.ts +1 -1
package/package.json
CHANGED
package/src/generators/render.js
CHANGED
|
@@ -6,7 +6,7 @@ import expressions from 'posthtml-expressions'
|
|
|
6
6
|
import { parseFrontMatter } from '../utils/node.js'
|
|
7
7
|
import defaultConfig from '../posthtml/defaultConfig.js'
|
|
8
8
|
import { process as compilePostHTML } from '../posthtml/index.js'
|
|
9
|
-
import { run as useTransformers
|
|
9
|
+
import { run as useTransformers } from '../transformers/index.js'
|
|
10
10
|
|
|
11
11
|
export async function render(html = '', config = {}) {
|
|
12
12
|
if (typeof html !== 'string') {
|
|
@@ -70,7 +70,6 @@ export async function render(html = '', config = {}) {
|
|
|
70
70
|
matter: matterData,
|
|
71
71
|
config: templateConfig,
|
|
72
72
|
posthtml: compilePostHTML,
|
|
73
|
-
transform: transformers,
|
|
74
73
|
})) ?? content
|
|
75
74
|
}
|
|
76
75
|
|
|
@@ -94,7 +93,6 @@ export async function render(html = '', config = {}) {
|
|
|
94
93
|
matter: matterData,
|
|
95
94
|
config: templateConfig,
|
|
96
95
|
posthtml: compilePostHTML,
|
|
97
|
-
transform: transformers,
|
|
98
96
|
})) ?? compiled.html
|
|
99
97
|
}
|
|
100
98
|
|
|
@@ -130,7 +128,6 @@ export async function render(html = '', config = {}) {
|
|
|
130
128
|
matter: matterData,
|
|
131
129
|
config: templateConfig,
|
|
132
130
|
posthtml: compilePostHTML,
|
|
133
|
-
transform: transformers,
|
|
134
131
|
})) ?? compiled.html
|
|
135
132
|
}
|
|
136
133
|
|
package/src/transformers/comb.js
CHANGED
|
@@ -2,6 +2,7 @@ import posthtml from 'posthtml'
|
|
|
2
2
|
import get from 'lodash-es/get.js'
|
|
3
3
|
import { defu as merge } from 'defu'
|
|
4
4
|
|
|
5
|
+
import core from './core.js'
|
|
5
6
|
import comb from './comb.js'
|
|
6
7
|
import sixHex from './sixHex.js'
|
|
7
8
|
import minify from './minify.js'
|
|
@@ -21,19 +22,17 @@ import replaceStrings from './replaceStrings.js'
|
|
|
21
22
|
import attributeToStyle from './attributeToStyle.js'
|
|
22
23
|
import removeAttributes from './removeAttributes.js'
|
|
23
24
|
|
|
24
|
-
import coreTransformers from './core.js'
|
|
25
|
-
|
|
26
25
|
import defaultPosthtmlConfig from '../posthtml/defaultConfig.js'
|
|
27
26
|
|
|
28
27
|
/**
|
|
29
28
|
* Use Maizzle Transformers on an HTML string.
|
|
30
29
|
*
|
|
31
|
-
* Only Transformers that are enabled in the
|
|
30
|
+
* Only Transformers that are enabled in the passed
|
|
31
|
+
* `config` parameter will be used.
|
|
32
32
|
*
|
|
33
33
|
* @param {string} html The HTML content
|
|
34
34
|
* @param {object} config The Maizzle config object
|
|
35
|
-
* @returns {Promise<{
|
|
36
|
-
* A Promise resolving to an object containing the original HTML, modified HTML, and the config
|
|
35
|
+
* @returns {Promise<{ html: string }>} A Promise resolving to an object containing the modified HTML
|
|
37
36
|
*/
|
|
38
37
|
export async function run(html = '', config = {}) {
|
|
39
38
|
const posthtmlPlugins = []
|
|
@@ -46,16 +45,16 @@ export async function run(html = '', config = {}) {
|
|
|
46
45
|
/**
|
|
47
46
|
* 1. Core transformers
|
|
48
47
|
*
|
|
49
|
-
* Transformers that are always enabled
|
|
48
|
+
* Transformers that are always enabled.
|
|
50
49
|
*
|
|
51
50
|
*/
|
|
52
|
-
posthtmlPlugins.push(
|
|
51
|
+
posthtmlPlugins.push(core(config))
|
|
53
52
|
|
|
54
53
|
/**
|
|
55
54
|
* 2. Safe class names
|
|
56
55
|
*
|
|
57
56
|
* Rewrite Tailwind CSS class names to email-safe alternatives,
|
|
58
|
-
* unless explicitly disabled
|
|
57
|
+
* unless explicitly disabled.
|
|
59
58
|
*/
|
|
60
59
|
if (get(config, 'css.safe') !== false) {
|
|
61
60
|
posthtmlPlugins.push(
|
|
@@ -66,7 +65,6 @@ export async function run(html = '', config = {}) {
|
|
|
66
65
|
/**
|
|
67
66
|
* 3. Filters
|
|
68
67
|
*
|
|
69
|
-
* Apply filters to HTML.
|
|
70
68
|
* Filters are always applied, unless explicitly disabled.
|
|
71
69
|
*/
|
|
72
70
|
if (get(config, 'filters') !== false) {
|
|
@@ -78,7 +76,7 @@ export async function run(html = '', config = {}) {
|
|
|
78
76
|
/**
|
|
79
77
|
* 4. Markdown
|
|
80
78
|
*
|
|
81
|
-
* Convert Markdown to HTML with
|
|
79
|
+
* Convert Markdown to HTML with markdown-it, unless explicitly disabled.
|
|
82
80
|
*/
|
|
83
81
|
if (get(config, 'markdown') !== false) {
|
|
84
82
|
posthtmlPlugins.push(
|
|
@@ -88,7 +86,9 @@ export async function run(html = '', config = {}) {
|
|
|
88
86
|
|
|
89
87
|
/**
|
|
90
88
|
* 5. Prevent widow words
|
|
91
|
-
*
|
|
89
|
+
*
|
|
90
|
+
* Enabled by default, will prevent widow words in elements
|
|
91
|
+
* wrapped with a `prevent-widows` attribute.
|
|
92
92
|
*/
|
|
93
93
|
if (get(config, 'widowWords') !== false) {
|
|
94
94
|
posthtmlPlugins.push(
|
|
@@ -110,7 +110,7 @@ export async function run(html = '', config = {}) {
|
|
|
110
110
|
/**
|
|
111
111
|
* 7. Inline CSS
|
|
112
112
|
*
|
|
113
|
-
* Inline CSS into HTML
|
|
113
|
+
* Inline CSS into HTML.
|
|
114
114
|
*/
|
|
115
115
|
if (get(config, 'css.inline')) {
|
|
116
116
|
posthtmlPlugins.push(inlineCSS(
|
|
@@ -150,7 +150,7 @@ export async function run(html = '', config = {}) {
|
|
|
150
150
|
/**
|
|
151
151
|
* 10. Shorthand CSS
|
|
152
152
|
*
|
|
153
|
-
* Convert longhand CSS properties to shorthand in `style` attributes
|
|
153
|
+
* Convert longhand CSS properties to shorthand in `style` attributes.
|
|
154
154
|
*/
|
|
155
155
|
if (get(config, 'css.shorthand')) {
|
|
156
156
|
posthtmlPlugins.push(
|
|
@@ -161,7 +161,7 @@ export async function run(html = '', config = {}) {
|
|
|
161
161
|
/**
|
|
162
162
|
* 11. Add attributes
|
|
163
163
|
*
|
|
164
|
-
* Add attributes to HTML tags
|
|
164
|
+
* Add attributes to HTML tags.
|
|
165
165
|
*/
|
|
166
166
|
if (get(config, 'attributes.add') !== false) {
|
|
167
167
|
posthtmlPlugins.push(
|
|
@@ -172,7 +172,7 @@ export async function run(html = '', config = {}) {
|
|
|
172
172
|
/**
|
|
173
173
|
* 12. Base URL
|
|
174
174
|
*
|
|
175
|
-
* Add a base URL to relative paths
|
|
175
|
+
* Add a base URL to relative paths.
|
|
176
176
|
*/
|
|
177
177
|
if (get(config, 'baseURL', get(config, 'baseUrl'))) {
|
|
178
178
|
posthtmlPlugins.push(
|
|
@@ -180,7 +180,7 @@ export async function run(html = '', config = {}) {
|
|
|
180
180
|
)
|
|
181
181
|
} else {
|
|
182
182
|
/**
|
|
183
|
-
* Set baseURL to `build.static.destination` if it's not already set
|
|
183
|
+
* Set baseURL to `build.static.destination` if it's not already set.
|
|
184
184
|
*/
|
|
185
185
|
const destination = get(config, 'build.static.destination', '')
|
|
186
186
|
if (destination && !config._dev) {
|
|
@@ -198,7 +198,7 @@ export async function run(html = '', config = {}) {
|
|
|
198
198
|
/**
|
|
199
199
|
* 13. URL parameters
|
|
200
200
|
*
|
|
201
|
-
* Add parameters to URLs
|
|
201
|
+
* Add parameters to URLs.
|
|
202
202
|
*/
|
|
203
203
|
if (get(config, 'urlParameters')) {
|
|
204
204
|
posthtmlPlugins.push(
|
|
@@ -209,8 +209,7 @@ export async function run(html = '', config = {}) {
|
|
|
209
209
|
/**
|
|
210
210
|
* 14. Six-digit HEX
|
|
211
211
|
*
|
|
212
|
-
*
|
|
213
|
-
* Always runs, unless explicitly disabled
|
|
212
|
+
* Enabled by default, converts three-digit HEX colors to six-digit.
|
|
214
213
|
*/
|
|
215
214
|
if (get(config, 'css.sixHex') !== false) {
|
|
216
215
|
posthtmlPlugins.push(
|
|
@@ -221,7 +220,7 @@ export async function run(html = '', config = {}) {
|
|
|
221
220
|
/**
|
|
222
221
|
* 15. PostHTML MSO
|
|
223
222
|
*
|
|
224
|
-
*
|
|
223
|
+
* Enabled by default, simplifies writing MSO conditionals for Outlook.
|
|
225
224
|
*/
|
|
226
225
|
if (get(config, 'outlook') !== false) {
|
|
227
226
|
posthtmlPlugins.push(
|
|
@@ -232,7 +231,7 @@ export async function run(html = '', config = {}) {
|
|
|
232
231
|
/**
|
|
233
232
|
* 16. Prettify
|
|
234
233
|
*
|
|
235
|
-
* Pretty-print HTML using js-beautify
|
|
234
|
+
* Pretty-print HTML using js-beautify.
|
|
236
235
|
*/
|
|
237
236
|
if (get(config, 'prettify')) {
|
|
238
237
|
posthtmlPlugins.push(
|
|
@@ -243,7 +242,7 @@ export async function run(html = '', config = {}) {
|
|
|
243
242
|
/**
|
|
244
243
|
* 17. Minify
|
|
245
244
|
*
|
|
246
|
-
* Minify HTML using html-crush
|
|
245
|
+
* Minify HTML using html-crush.
|
|
247
246
|
*/
|
|
248
247
|
if (get(config, 'minify')) {
|
|
249
248
|
posthtmlPlugins.push(
|
|
@@ -254,14 +253,14 @@ export async function run(html = '', config = {}) {
|
|
|
254
253
|
/**
|
|
255
254
|
* 18. <template> tags
|
|
256
255
|
*
|
|
257
|
-
* Replace <template> tags with their content
|
|
256
|
+
* Replace <template> tags with their content.
|
|
258
257
|
*/
|
|
259
258
|
posthtmlPlugins.push(templateTag())
|
|
260
259
|
|
|
261
260
|
/**
|
|
262
261
|
* 19. Replace strings
|
|
263
262
|
*
|
|
264
|
-
* Replace strings through regular expressions
|
|
263
|
+
* Replace strings through regular expressions.
|
|
265
264
|
*/
|
|
266
265
|
if (get(config, 'replaceStrings')) {
|
|
267
266
|
posthtmlPlugins.push(
|
|
@@ -275,23 +274,3 @@ export async function run(html = '', config = {}) {
|
|
|
275
274
|
html: result.html,
|
|
276
275
|
}))
|
|
277
276
|
}
|
|
278
|
-
|
|
279
|
-
export const transformers = {
|
|
280
|
-
comb,
|
|
281
|
-
sixHex,
|
|
282
|
-
minify,
|
|
283
|
-
baseUrl,
|
|
284
|
-
inlineCSS,
|
|
285
|
-
prettify,
|
|
286
|
-
filters,
|
|
287
|
-
markdown,
|
|
288
|
-
posthtmlMso,
|
|
289
|
-
shorthandCss,
|
|
290
|
-
preventWidows,
|
|
291
|
-
addAttributes,
|
|
292
|
-
urlParameters,
|
|
293
|
-
safeClassNames,
|
|
294
|
-
replaceStrings,
|
|
295
|
-
attributeToStyle,
|
|
296
|
-
removeAttributes,
|
|
297
|
-
}
|
|
@@ -12,9 +12,10 @@ import isObject from 'lodash-es/isObject.js'
|
|
|
12
12
|
import { parser as parse } from 'posthtml-parser'
|
|
13
13
|
import { parseCSSRule } from '../utils/string.js'
|
|
14
14
|
import { useAttributeSizes } from './useAttributeSizes.js'
|
|
15
|
+
import defaultPostHTMLConfig from '../posthtml/defaultConfig.js'
|
|
15
16
|
|
|
16
17
|
const posthtmlPlugin = (options = {}) => tree => {
|
|
17
|
-
return inline(render(tree), options).then(html => parse(html))
|
|
18
|
+
return inline(render(tree), options).then(html => parse(html, defaultPostHTMLConfig))
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
export default posthtmlPlugin
|
|
@@ -4,6 +4,7 @@ import { defu as merge } from 'defu'
|
|
|
4
4
|
import { render } from 'posthtml-render'
|
|
5
5
|
import { parser as parse } from 'posthtml-parser'
|
|
6
6
|
import posthtmlConfig from '../posthtml/defaultConfig.js'
|
|
7
|
+
import defaultPostHTMLConfig from '../posthtml/defaultConfig.js'
|
|
7
8
|
|
|
8
9
|
const posthtmlPlugin = (options = {}) => tree => {
|
|
9
10
|
options = merge(options, {
|
|
@@ -12,7 +13,7 @@ const posthtmlPlugin = (options = {}) => tree => {
|
|
|
12
13
|
|
|
13
14
|
const { result: html } = crush(render(tree), options)
|
|
14
15
|
|
|
15
|
-
return parse(html)
|
|
16
|
+
return parse(html, defaultPostHTMLConfig)
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
export default posthtmlPlugin
|
|
@@ -4,6 +4,7 @@ import { render } from 'posthtml-render'
|
|
|
4
4
|
import isEmpty from 'lodash-es/isEmpty.js'
|
|
5
5
|
import { parser as parse } from 'posthtml-parser'
|
|
6
6
|
import posthtmlConfig from '../posthtml/defaultConfig.js'
|
|
7
|
+
import defaultPostHTMLConfig from '../posthtml/defaultConfig.js'
|
|
7
8
|
|
|
8
9
|
const posthtmlPlugin = (replacements = {}) => tree => {
|
|
9
10
|
if (!isEmpty(replacements)) {
|
|
@@ -17,7 +18,8 @@ const posthtmlPlugin = (replacements = {}) => tree => {
|
|
|
17
18
|
return replacement
|
|
18
19
|
}
|
|
19
20
|
}
|
|
20
|
-
})
|
|
21
|
+
}),
|
|
22
|
+
defaultPostHTMLConfig
|
|
21
23
|
)
|
|
22
24
|
}
|
|
23
25
|
|
package/types/build.d.ts
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
import ComponentsConfig from './components';
|
|
2
1
|
import type { SpinnerName } from 'cli-spinners';
|
|
3
2
|
import type ExpressionsConfig from './expressions';
|
|
4
3
|
|
|
5
4
|
export default interface BuildConfig {
|
|
6
|
-
/**
|
|
7
|
-
* Components configuration.
|
|
8
|
-
*/
|
|
9
|
-
components?: ComponentsConfig;
|
|
10
|
-
|
|
11
5
|
/**
|
|
12
6
|
* Paths where Maizzle should look for Templates to compile.
|
|
13
7
|
*
|
|
@@ -22,7 +16,7 @@ export default interface BuildConfig {
|
|
|
22
16
|
* }
|
|
23
17
|
* ```
|
|
24
18
|
*/
|
|
25
|
-
content?: string
|
|
19
|
+
content?: string[];
|
|
26
20
|
|
|
27
21
|
/**
|
|
28
22
|
Configure expressions.
|
|
@@ -88,21 +82,6 @@ export default interface BuildConfig {
|
|
|
88
82
|
* @default undefined
|
|
89
83
|
*/
|
|
90
84
|
destination?: string;
|
|
91
|
-
} | {
|
|
92
|
-
/**
|
|
93
|
-
* An array of objects specifying source and destination directories for static files.
|
|
94
|
-
*/
|
|
95
|
-
static: Array<{
|
|
96
|
-
/**
|
|
97
|
-
* Array of paths where Maizzle should look for static files.
|
|
98
|
-
*/
|
|
99
|
-
source: string[];
|
|
100
|
-
/**
|
|
101
|
-
* Directory where static files should be copied to,
|
|
102
|
-
* relative to the `build.output` path.
|
|
103
|
-
*/
|
|
104
|
-
destination: string;
|
|
105
|
-
}>;
|
|
106
85
|
};
|
|
107
86
|
|
|
108
87
|
/**
|
package/types/config.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import type PostHTMLConfig from './posthtml';
|
|
|
5
5
|
import type MarkdownConfig from './markdown';
|
|
6
6
|
import type { ProcessOptions } from 'postcss';
|
|
7
7
|
import type PurgeCSSConfig from './css/purge';
|
|
8
|
+
import type PlaintextConfig from './plaintext';
|
|
8
9
|
import type CSSInlineConfig from './css/inline';
|
|
9
10
|
import type { SpinnerName } from 'cli-spinners';
|
|
10
11
|
import type ComponentsConfig from './components';
|
|
@@ -12,7 +13,6 @@ import type WidowWordsConfig from './widowWords';
|
|
|
12
13
|
import type { CoreBeautifyOptions } from 'js-beautify';
|
|
13
14
|
import type { BaseURLConfig } from 'posthtml-base-url';
|
|
14
15
|
import type URLParametersConfig from './urlParameters';
|
|
15
|
-
import type PlaintextConfig from './plaintext';
|
|
16
16
|
|
|
17
17
|
import type { Config as TailwindConfig } from 'tailwindcss';
|
|
18
18
|
|
|
@@ -60,20 +60,8 @@ export default interface Config {
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
/**
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
@example
|
|
66
|
-
```
|
|
67
|
-
export default {
|
|
68
|
-
build: {
|
|
69
|
-
components: ComponentsConfig,
|
|
70
|
-
posthtml: PostHTMLConfig,
|
|
71
|
-
tailwind: TailwindConfig,
|
|
72
|
-
templates: TemplatesConfig,
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
```
|
|
76
|
-
*/
|
|
63
|
+
* Configure build settings.
|
|
64
|
+
*/
|
|
77
65
|
build: BuildConfig;
|
|
78
66
|
|
|
79
67
|
/**
|
|
@@ -177,7 +165,6 @@ export default interface Config {
|
|
|
177
165
|
|
|
178
166
|
/**
|
|
179
167
|
* Use a custom Tailwind CSS configuration object.
|
|
180
|
-
*
|
|
181
168
|
*/
|
|
182
169
|
tailwind?: TailwindConfig;
|
|
183
170
|
}
|
|
@@ -221,7 +208,7 @@ export default interface Config {
|
|
|
221
208
|
* <p>{{ company.name }}</p>
|
|
222
209
|
* ```
|
|
223
210
|
*/
|
|
224
|
-
locals?: Record<string, any>;
|
|
211
|
+
locals?: Record<string, any>;
|
|
225
212
|
|
|
226
213
|
/**
|
|
227
214
|
* Configure the Markdown parser.
|
package/types/events.d.ts
CHANGED
|
@@ -1,172 +1,7 @@
|
|
|
1
1
|
import type Config from "./config";
|
|
2
|
-
import type {
|
|
3
|
-
safeClassNames,
|
|
4
|
-
markdown,
|
|
5
|
-
preventWidows,
|
|
6
|
-
attributeToStyle,
|
|
7
|
-
inlineCSS,
|
|
8
|
-
shorthandCSS,
|
|
9
|
-
removeUnusedCSS,
|
|
10
|
-
purgeCSS,
|
|
11
|
-
removeAttributes,
|
|
12
|
-
addAttributes,
|
|
13
|
-
prettify,
|
|
14
|
-
applyBaseURL,
|
|
15
|
-
addUrlParams,
|
|
16
|
-
sixHEX,
|
|
17
|
-
minify,
|
|
18
|
-
replaceStrings,
|
|
19
|
-
plaintext,
|
|
20
|
-
} from "./index";
|
|
21
2
|
|
|
22
3
|
type PostHTMLType = (html: string, config: Config) => { html: string; config: Config };
|
|
23
4
|
|
|
24
|
-
type TransformType = {
|
|
25
|
-
/**
|
|
26
|
-
* Normalize escaped character class names like `\:` or `\/` by replacing them with email-safe alternatives.
|
|
27
|
-
*
|
|
28
|
-
* @param {string} html The HTML string to normalize.
|
|
29
|
-
* @param {Record<string, string>} replacements A dictionary of replacements to apply.
|
|
30
|
-
* @returns {string} The normalized HTML string.
|
|
31
|
-
* @see https://maizzle.com/docs/transformers/safe-class-names
|
|
32
|
-
*/
|
|
33
|
-
safeClassNames: typeof safeClassNames;
|
|
34
|
-
/**
|
|
35
|
-
* Compile Markdown to HTML.
|
|
36
|
-
*
|
|
37
|
-
* @param {string} input The Markdown string to compile.
|
|
38
|
-
* @param {MarkdownConfig} [options] A configuration object for the Markdown compiler.
|
|
39
|
-
* @returns {string} The compiled HTML string.
|
|
40
|
-
* @see https://maizzle.com/docs/transformers/markdown
|
|
41
|
-
*/
|
|
42
|
-
markdown: typeof markdown;
|
|
43
|
-
/**
|
|
44
|
-
* Prevent widow words inside a tag by adding a ` ` between its last two words.
|
|
45
|
-
*
|
|
46
|
-
* @param {string} html The HTML string to process.
|
|
47
|
-
* @param {WidowWordsConfig} [options] A configuration object for the widow words transformer.
|
|
48
|
-
* @returns {string} The processed HTML string.
|
|
49
|
-
* @see https://maizzle.com/docs/transformers/widows
|
|
50
|
-
*/
|
|
51
|
-
preventWidows: typeof preventWidows;
|
|
52
|
-
/**
|
|
53
|
-
* Duplicate HTML attributes to inline CSS.
|
|
54
|
-
*
|
|
55
|
-
* @param {string} html The HTML string to process.
|
|
56
|
-
* @param {AttributeToStyleSupportedAttributes[]} attributes An array of attributes to inline.
|
|
57
|
-
* @param {PostHTMLConfig} [posthtmlConfig] A configuration object for PostHTML.
|
|
58
|
-
* @returns {string} The processed HTML string.
|
|
59
|
-
* @see https://maizzle.com/docs/transformers/attribute-to-style
|
|
60
|
-
*/
|
|
61
|
-
attributeToStyle: typeof attributeToStyle;
|
|
62
|
-
/**
|
|
63
|
-
* Inline CSS styles in an HTML string.
|
|
64
|
-
*
|
|
65
|
-
* @param {string} html The HTML string to process.
|
|
66
|
-
* @param {CSSInlineConfig} [options] A configuration object for the CSS inliner.
|
|
67
|
-
* @returns {string} The processed HTML string.
|
|
68
|
-
* @see https://maizzle.com/docs/transformers/inline-css
|
|
69
|
-
*/
|
|
70
|
-
inlineCSS: typeof inlineCSS;
|
|
71
|
-
/**
|
|
72
|
-
* Rewrite longhand CSS inside style attributes with shorthand syntax.
|
|
73
|
-
* Only works with margin, padding and border, and only when all sides are specified.
|
|
74
|
-
*
|
|
75
|
-
* @param {string} html The HTML string to process.
|
|
76
|
-
* @returns {string} The processed HTML string.
|
|
77
|
-
* @see https://maizzle.com/docs/transformers/shorthand-css
|
|
78
|
-
*/
|
|
79
|
-
shorthandCSS: typeof shorthandCSS;
|
|
80
|
-
/**
|
|
81
|
-
* Remove unused CSS from `<style>` tags and HTML elements.
|
|
82
|
-
*
|
|
83
|
-
* @param {string} html The HTML string to process.
|
|
84
|
-
* @param {PurgeCSSConfig} [options] A configuration object for `email-comb`.
|
|
85
|
-
* @returns {string} The processed HTML string.
|
|
86
|
-
* @see https://maizzle.com/docs/transformers/remove-unused-css
|
|
87
|
-
*/
|
|
88
|
-
removeUnusedCSS: typeof removeUnusedCSS;
|
|
89
|
-
/**
|
|
90
|
-
* Remove HTML attributes from an HTML string.
|
|
91
|
-
*
|
|
92
|
-
* @param {string} html The HTML string to process.
|
|
93
|
-
* @param {string[] | Array<{ name: string; value: string | RegExp }>} [options] An array of attribute names to remove, or an array of objects with `name` and `value` properties.
|
|
94
|
-
* @returns {string} The processed HTML string.
|
|
95
|
-
* @see https://maizzle.com/docs/transformers/remove-attributes
|
|
96
|
-
*/
|
|
97
|
-
removeAttributes: typeof removeAttributes;
|
|
98
|
-
/**
|
|
99
|
-
* Add attributes to elements in an HTML string.
|
|
100
|
-
*
|
|
101
|
-
* @param {string} html The HTML string to process.
|
|
102
|
-
* @param {Record<string, unknown>} [options] A dictionary of attributes to add.
|
|
103
|
-
* @returns {string} The processed HTML string.
|
|
104
|
-
* @see https://maizzle.com/docs/transformers/add-attributes
|
|
105
|
-
*/
|
|
106
|
-
addAttributes: typeof addAttributes;
|
|
107
|
-
/**
|
|
108
|
-
* Pretty-print an HTML string.
|
|
109
|
-
*
|
|
110
|
-
* @param {string} html The HTML string to prettify.
|
|
111
|
-
* @param {HTMLBeautifyOptions} [options] A configuration object for `js-beautify`.
|
|
112
|
-
* @returns {string} The prettified HTML string.
|
|
113
|
-
* @see https://maizzle.com/docs/transformers/prettify
|
|
114
|
-
*/
|
|
115
|
-
prettify: typeof prettify;
|
|
116
|
-
/**
|
|
117
|
-
* Prepend a string to sources and hrefs in an HTML string.
|
|
118
|
-
*
|
|
119
|
-
* @param {string} html The HTML string to process.
|
|
120
|
-
* @param {string | BaseURLConfig} [options] A string to prepend to sources and hrefs, or a configuration object for `posthtml-base-url`.
|
|
121
|
-
* @returns {string} The processed HTML string.
|
|
122
|
-
* @see https://maizzle.com/docs/transformers/base-url
|
|
123
|
-
*/
|
|
124
|
-
applyBaseURL: typeof applyBaseURL;
|
|
125
|
-
/**
|
|
126
|
-
* Append parameters to URLs in an HTML string.
|
|
127
|
-
*
|
|
128
|
-
* @param {string} html The HTML string to process.
|
|
129
|
-
* @param {URLParametersConfig} [options] A configuration object for `posthtml-url-parameters`.
|
|
130
|
-
* @returns {string} The processed HTML string.
|
|
131
|
-
* @see https://maizzle.com/docs/transformers/url-parameters
|
|
132
|
-
*/
|
|
133
|
-
addUrlParams: typeof addUrlParams;
|
|
134
|
-
/**
|
|
135
|
-
* Ensure that all HEX colors inside `bgcolor` and `color` attributes are defined with six digits.
|
|
136
|
-
*
|
|
137
|
-
* @param {string} html The HTML string to process.
|
|
138
|
-
* @returns {string} The processed HTML string.
|
|
139
|
-
* @see https://maizzle.com/docs/transformers/six-hex
|
|
140
|
-
*/
|
|
141
|
-
sixHEX: typeof sixHEX;
|
|
142
|
-
/**
|
|
143
|
-
* Minify an HTML string, with email client considerations.
|
|
144
|
-
*
|
|
145
|
-
* @param {string} html The HTML string to minify.
|
|
146
|
-
* @param {MinifyConfig} [options] A configuration object for `html-minifier`.
|
|
147
|
-
* @returns {string} The minified HTML string.
|
|
148
|
-
* @see https://maizzle.com/docs/transformers/minify
|
|
149
|
-
*/
|
|
150
|
-
minify: typeof minify;
|
|
151
|
-
/**
|
|
152
|
-
* Batch-replace strings in an HTML string.
|
|
153
|
-
*
|
|
154
|
-
* @param {string} html The HTML string to process.
|
|
155
|
-
* @param {Record<string, string>} [replacements] A dictionary of strings to replace.
|
|
156
|
-
* @returns {string} The processed HTML string.
|
|
157
|
-
* @see https://maizzle.com/docs/transformers/replace-strings
|
|
158
|
-
*/
|
|
159
|
-
replaceStrings: typeof replaceStrings;
|
|
160
|
-
/**
|
|
161
|
-
* Generate a plaintext version of an HTML string.
|
|
162
|
-
* @param {string} html - The HTML string to convert to plaintext.
|
|
163
|
-
* @param {PlaintextConfig} [options] - A configuration object for the plaintext generator.
|
|
164
|
-
* @returns {Promise<string>} The plaintext version of the HTML string.
|
|
165
|
-
* @see https://maizzle.com/docs/plaintext
|
|
166
|
-
*/
|
|
167
|
-
plaintext: typeof plaintext;
|
|
168
|
-
};
|
|
169
|
-
|
|
170
5
|
export default interface Events {
|
|
171
6
|
/**
|
|
172
7
|
* Runs after the Environment config has been computed, but before Templates are processed.
|
|
@@ -195,7 +30,7 @@ export default interface Events {
|
|
|
195
30
|
* @example
|
|
196
31
|
* ```
|
|
197
32
|
* export default {
|
|
198
|
-
* beforeRender: async ({html, matter, config, posthtml
|
|
33
|
+
* beforeRender: async ({html, matter, config, posthtml}) => {
|
|
199
34
|
* // do something...
|
|
200
35
|
* return html;
|
|
201
36
|
* }
|
|
@@ -222,10 +57,6 @@ export default interface Events {
|
|
|
222
57
|
* @param {Config} config The Maizzle config object.
|
|
223
58
|
*/
|
|
224
59
|
posthtml: PostHTMLType;
|
|
225
|
-
/**
|
|
226
|
-
* A collection of Maizzle Transformers.
|
|
227
|
-
*/
|
|
228
|
-
transform: TransformType;
|
|
229
60
|
}) => string | Promise<string>;
|
|
230
61
|
|
|
231
62
|
/**
|
|
@@ -238,7 +69,7 @@ export default interface Events {
|
|
|
238
69
|
* @example
|
|
239
70
|
* ```
|
|
240
71
|
* export default {
|
|
241
|
-
* afterRender: async async ({html, matter, config, posthtml
|
|
72
|
+
* afterRender: async async ({html, matter, config, posthtml}) => {
|
|
242
73
|
* // do something...
|
|
243
74
|
* return html;
|
|
244
75
|
* }
|
|
@@ -265,10 +96,6 @@ export default interface Events {
|
|
|
265
96
|
* @param {Config} config The Maizzle config object.
|
|
266
97
|
*/
|
|
267
98
|
posthtml: PostHTMLType;
|
|
268
|
-
/**
|
|
269
|
-
* A collection of Maizzle Transformers.
|
|
270
|
-
*/
|
|
271
|
-
transform: TransformType;
|
|
272
99
|
}) => string | Promise<string>;
|
|
273
100
|
|
|
274
101
|
/**
|
|
@@ -281,7 +108,7 @@ export default interface Events {
|
|
|
281
108
|
* @example
|
|
282
109
|
* ```
|
|
283
110
|
* export default {
|
|
284
|
-
* afterTransformers: async ({html, matter, config, posthtml
|
|
111
|
+
* afterTransformers: async ({html, matter, config, posthtml}) => {
|
|
285
112
|
* // do something...
|
|
286
113
|
* return html;
|
|
287
114
|
* }
|
|
@@ -308,10 +135,6 @@ export default interface Events {
|
|
|
308
135
|
* @param {Config} config The Maizzle config object.
|
|
309
136
|
*/
|
|
310
137
|
posthtml: PostHTMLType;
|
|
311
|
-
/**
|
|
312
|
-
* A collection of Maizzle Transformers.
|
|
313
|
-
*/
|
|
314
|
-
transform: TransformType;
|
|
315
138
|
}) => string | Promise<string>;
|
|
316
139
|
|
|
317
140
|
/**
|
|
@@ -323,7 +146,7 @@ export default interface Events {
|
|
|
323
146
|
* @example
|
|
324
147
|
* ```
|
|
325
148
|
* export default {
|
|
326
|
-
* afterBuild: async ({files, config
|
|
149
|
+
* afterBuild: async ({files, config}) => {
|
|
327
150
|
* // do something...
|
|
328
151
|
* }
|
|
329
152
|
* }
|
|
@@ -338,9 +161,5 @@ export default interface Events {
|
|
|
338
161
|
* The Maizzle config object.
|
|
339
162
|
*/
|
|
340
163
|
config: Config;
|
|
341
|
-
/**
|
|
342
|
-
* A collection of Maizzle Transformers.
|
|
343
|
-
*/
|
|
344
|
-
transform: TransformType;
|
|
345
164
|
}) => string | Promise<string>;
|
|
346
165
|
}
|
package/types/urlParameters.d.ts
CHANGED