1 | /*!
|
2 | * gulp-format-md <https://github.com/jonschlinkert/gulp-format-md>
|
3 | *
|
4 | * Copyright (c) 2015-present, Jon Schlinkert.
|
5 | * Licensed under the MIT License.
|
6 | */
|
7 |
|
8 | ;
|
9 |
|
10 | const format = require('./format');
|
11 | const utils = require('./utils');
|
12 |
|
13 | module.exports = config => {
|
14 | let options = { formatMd: config, ...config };
|
15 |
|
16 | return (file, next) => {
|
17 | if (file.isNull() || !file.extname || !utils.isMarkdown(file.extname)) {
|
18 | next();
|
19 | return;
|
20 | }
|
21 |
|
22 | let opts = { ...options, ...file.options, ...file.data };
|
23 | format(file, opts);
|
24 | next(null, file);
|
25 | };
|
26 | };
|