diff --git a/packages/remark-parse/index.js b/packages/remark-parse/index.js index 357bf421f..9719b7976 100644 --- a/packages/remark-parse/index.js +++ b/packages/remark-parse/index.js @@ -10,12 +10,15 @@ function parse(options) { this.Parser = parse function parse(doc) { - var settings = Object.assign({}, self.data('settings'), options) - // Note: these options are not in the readme. - // The goal is for them to be set by plugins on `data` instead of being - // passed by users. - settings.extensions = settings.micromarkExtensions - settings.mdastExtensions = settings.fromMarkdownExtensions - return fromMarkdown(doc, settings) + return fromMarkdown( + doc, + Object.assign({}, self.data('settings'), options, { + // Note: these options are not in the readme. + // The goal is for them to be set by plugins on `data` instead of being + // passed by users. + extensions: self.data('micromarkExtensions') || [], + mdastExtensions: self.data('fromMarkdownExtensions') || [] + }) + ) } } diff --git a/packages/remark-parse/test.js b/packages/remark-parse/test.js index b099d1922..3db02e560 100644 --- a/packages/remark-parse/test.js +++ b/packages/remark-parse/test.js @@ -17,10 +17,9 @@ test('remark().parse(file)', function (t) { t.test('extensions', function (st) { var tree = unified() - .use(parse, { - micromarkExtensions: [gfmSyntax()], - fromMarkdownExtensions: [gfm] - }) + .data('micromarkExtensions', [gfmSyntax()]) + .data('fromMarkdownExtensions', [gfm]) + .use(parse) .parse('* [x] contact@example.com ~~strikethrough~~') remove(tree, true) diff --git a/packages/remark-stringify/index.js b/packages/remark-stringify/index.js index 06bcdf58e..61211b43e 100644 --- a/packages/remark-stringify/index.js +++ b/packages/remark-stringify/index.js @@ -10,11 +10,14 @@ function stringify(options) { this.Compiler = compile function compile(tree) { - var settings = Object.assign({}, self.data('settings'), options) - // Note: this option is not in the readme. - // The goal is for it to be set by plugins on `data` instead of being - // passed by users. - settings.extensions = settings.toMarkdownExtensions - return toMarkdown(tree, settings) + return toMarkdown( + tree, + Object.assign({}, self.data('settings'), options, { + // Note: this option is not in the readme. + // The goal is for it to be set by plugins on `data` instead of being + // passed by users. + extensions: self.data('toMarkdownExtensions') || [] + }) + ) } } diff --git a/packages/remark-stringify/test.js b/packages/remark-stringify/test.js index 48ff8c93a..9f14a2255 100644 --- a/packages/remark-stringify/test.js +++ b/packages/remark-stringify/test.js @@ -461,7 +461,8 @@ test('stringify escapes', function (t) { test('extensions', function (t) { var doc = unified() - .use(stringify, {toMarkdownExtensions: [gfm()]}) + .data('toMarkdownExtensions', [gfm()]) + .use(stringify) .stringify({ type: 'root', children: [