1 |
|
2 | module.exports = createMDScope
|
3 |
|
4 | const runAsync = require('run-async')
|
5 |
|
6 | function createMDScope (plugins, markdown) {
|
7 | return Promise.all(
|
8 | plugins
|
9 | .map(plugin => runAsync(plugin))
|
10 | .map(plugin => plugin(markdown))
|
11 | )
|
12 | .then(scopes => scopes.reduce(
|
13 | (scope, pluginScope) => Object.assign(scope, pluginScope), {})
|
14 | )
|
15 | }
|