Fix indented container directives

Closes GH-1.
This commit is contained in:
Titus Wormer 2020-12-13 11:08:08 +01:00
parent 20b2396fe9
commit d9da5c508d
No known key found for this signature in database
GPG key ID: E6E581152ED04E2E
2 changed files with 31 additions and 1 deletions

View file

@ -104,7 +104,13 @@ function tokenizeDirectiveContainer(effects, ok, nok) {
}
function chunkStart(code) {
var token = effects.enter('chunkDocument', {
var token
if (code === null) {
return after(code)
}
token = effects.enter('chunkDocument', {
contentType: 'document',
previous: previous
})

24
test.js
View file

@ -1020,6 +1020,30 @@ test('micromark-extension-directive (syntax)', function (t) {
'should support a thematic break before a container'
)
t.equal(
micromark(' :::x\n ', options({'*': h})),
'<x></x>',
'should support prefixed containers (1)'
)
t.equal(
micromark(' :::x\n - a', options({'*': h})),
'<x>\n<ul>\n<li>a</li>\n</ul>\n</x>',
'should support prefixed containers (2)'
)
t.equal(
micromark(' :::x\n - a\n > b', options({'*': h})),
'<x>\n<ul>\n<li>a</li>\n</ul>\n<blockquote>\n<p>b</p>\n</blockquote>\n</x>',
'should support prefixed containers (3)'
)
t.equal(
micromark(' :::x\n - a\n > b\n :::', options({'*': h})),
'<x>\n<ul>\n<li>a</li>\n</ul>\n<blockquote>\n<p>b</p>\n</blockquote>\n</x>',
'should support prefixed containers (4)'
)
t.end()
})