UNPKG

582 BJavaScriptView Raw
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'use strict';
9
10const format = require('./format');
11const utils = require('./utils');
12
13module.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};