-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
39 lines (33 loc) · 873 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/**
* Copyright (C) 2016 pantojs.xyz
* index.js
*
* changelog
* 2016-11-04[11:14:18]:revised
*
* @author [email protected]
* @version 0.1.0
* @since 0.1.0
*/
'use strict';
const Transformer = require('panto-transformer');
const MarkdownIt = require('markdown-it');
class MarkdownTransformer extends Transformer {
_transform(file) {
return new Promise(resolve => {
const md = MarkdownIt(this.options.markdownOptions || {});
const plugins = this.options.markdownPlugins || [];
for (let plugin of plugins) {
md.use(...plugin);
}
const result = md.render(file.content);
resolve(panto._.extend(file, {
content: result
}));
});
}
isTorrential() {
return false;
}
}
module.exports = MarkdownTransformer;