diff --git a/dev/lib/directive-container.js b/dev/lib/directive-container.js index 76114c3..ba97138 100644 --- a/dev/lib/directive-container.js +++ b/dev/lib/directive-container.js @@ -197,12 +197,14 @@ function tokenizeDirectiveContainer(effects, ok, nok) { */ function tokenizeClosingFence(effects, ok, nok) { let size = 0 - + assert(self.parser.constructs.disable.null, 'expected `disable.null`') return factorySpace( effects, closingPrefixAfter, types.linePrefix, - constants.tabSize + self.parser.constructs.disable.null.includes('codeIndented') + ? undefined + : constants.tabSize ) /** @type {State} */ diff --git a/test/index.js b/test/index.js index 648ef29..9886878 100644 --- a/test/index.js +++ b/test/index.js @@ -993,6 +993,20 @@ test('micromark-extension-directive (syntax, container)', async function (t) { } ) + await t.test( + 'should strip arbitrary length prefix from closing fence line (codeIndented disabled)', + async function () { + assert.equal( + micromark(':::x\nalpha.\n :::\n\nbravo.', { + allowDangerousHtml: true, + extensions: [directive(), {disable: {null: ['codeIndented']}}], + htmlExtensions: [directiveHtml()] + }), + '

bravo.

' + ) + } + ) + await t.test( 'should support a block quote after a container', async function () {