diff --git a/lib/syntax.js b/lib/syntax.js index a6c541f..3be3104 100644 --- a/lib/syntax.js +++ b/lib/syntax.js @@ -8,10 +8,16 @@ function create(options) { var index = -1 var flow = {} var matter + var code while (++index < length) { matter = settings[index] - flow[fence(matter, 'open').charCodeAt(0)] = parse(matter) + code = fence(matter, 'open').charCodeAt(0) + if (code in flow) { + flow[code].push(parse(matter)) + } else { + flow[code] = [parse(matter)] + } } return {flow: flow} diff --git a/test.js b/test.js index a86f629..680aad6 100644 --- a/test.js +++ b/test.js @@ -6,6 +6,7 @@ var html = require('./html') var custom = {type: 'custom', marker: {open: '<', close: '>'}} var json = {type: 'json', fence: {open: '{', close: '}'}} var yamlAnywhere = {type: 'yaml', marker: '-', anywhere: true} +var customAndYaml = [{type: 'custom', marker: {open: '-', close: '.'}}, 'yaml'] test('core', function (t) { t.throws( @@ -232,5 +233,14 @@ test('markdown -> html (micromark)', function (t) { 'should not support custom matters in the middle' ) + t.deepEqual( + micromark('---\nasd\n...', { + extensions: [syntax(customAndYaml)], + htmlExtensions: [html(customAndYaml)] + }), + '', + 'should not support custom matters in the middle' + ) + t.end() })