Skip to content

Commit 0f125c0

Browse files
committed
feat: allow users to pass plugins
Allow users to pass plugin options in the same syntax they are typically passed to remark (e.g. a two item array -- first being the plugin and second being an object containing the options). This doesn't break the existing behavior, i.e. users can still just pass the plugin by itself.
1 parent 2eeceb1 commit 0f125c0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/parse.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ module.exports = function(markdown, options = {}) {
1919
return new Promise((resolve, reject) => {
2020
plugins
2121
.reduce((remark, item) => {
22-
return remark.use(item)
22+
if ( Array.isArray(item) ) {
23+
return remark.use.apply(null, item)
24+
25+
} else return remark.use(item)
2326
}, Remark())
2427
.use(RemarkHTML) // RECONSIDER: options.output === 'html' ? RemarkHTML : RemarkReact)
2528
.process(parsed.body, (err, file) => {

0 commit comments

Comments
 (0)