Add test for directives w/ containers
Related to GH-3.
This commit is contained in:
parent
b153bdd596
commit
d40008f5c7
3 changed files with 22 additions and 14 deletions
|
@ -139,8 +139,8 @@ function tokenizeDirectiveContainer(effects, ok, nok) {
|
|||
return after(code)
|
||||
}
|
||||
|
||||
const token = effects.enter('chunkDocument', {
|
||||
contentType: 'document',
|
||||
const token = effects.enter(types.chunkDocument, {
|
||||
contentType: constants.contentTypeDocument,
|
||||
previous
|
||||
})
|
||||
if (previous) previous.next = token
|
||||
|
@ -151,13 +151,15 @@ function tokenizeDirectiveContainer(effects, ok, nok) {
|
|||
/** @type {State} */
|
||||
function contentContinue(code) {
|
||||
if (code === codes.eof) {
|
||||
effects.exit('chunkDocument')
|
||||
const t = effects.exit(types.chunkDocument)
|
||||
self.parser.lazy[t.start.line] = false
|
||||
return after(code)
|
||||
}
|
||||
|
||||
if (markdownLineEnding(code)) {
|
||||
effects.consume(code)
|
||||
effects.exit('chunkDocument')
|
||||
const t = effects.exit(types.chunkDocument)
|
||||
self.parser.lazy[t.start.line] = false
|
||||
return lineStart
|
||||
}
|
||||
|
||||
|
|
16
package.json
16
package.json
|
@ -38,19 +38,19 @@
|
|||
"default": "./index.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"micromark-factory-space": "^1.0.0-alpha.2",
|
||||
"micromark-factory-whitespace": "^1.0.0-alpha.2",
|
||||
"micromark-util-character": "^1.0.0-alpha.2",
|
||||
"micromark-util-symbol": "^1.0.0-alpha.2",
|
||||
"micromark-util-types": "^1.0.0-alpha.2",
|
||||
"micromark-factory-space": "^1.0.0-beta.1",
|
||||
"micromark-factory-whitespace": "^1.0.0-beta.1",
|
||||
"micromark-util-character": "^1.0.0-beta.1",
|
||||
"micromark-util-symbol": "^1.0.0-beta.1",
|
||||
"micromark-util-types": "^1.0.0-beta.1",
|
||||
"parse-entities": "^3.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/tape": "^4.0.0",
|
||||
"c8": "^7.0.0",
|
||||
"html-void-elements": "^2.0.0",
|
||||
"micromark": "^3.0.0-alpha.2",
|
||||
"micromark-build": "^1.0.0-alpha.2",
|
||||
"micromark": "^3.0.0-beta.1",
|
||||
"micromark-build": "^1.0.0-beta.1",
|
||||
"prettier": "^2.0.0",
|
||||
"remark-cli": "^9.0.0",
|
||||
"remark-preset-wooorm": "^8.0.0",
|
||||
|
@ -58,7 +58,7 @@
|
|||
"tape": "^5.0.0",
|
||||
"type-coverage": "^2.0.0",
|
||||
"typescript": "^4.0.0",
|
||||
"xo": "^0.40.0"
|
||||
"xo": "^0.39.0"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "rimraf \"dev/**/*.d.ts\" \"test/**/*.d.ts\" && tsc && type-coverage && micromark-build",
|
||||
|
|
|
@ -1032,7 +1032,7 @@ test('micromark-extension-directive (syntax)', (t) => {
|
|||
|
||||
t.equal(
|
||||
micromark('>a\n:::a\nb', options()),
|
||||
'<blockquote>\n<p>a</p>\n</blockquote>\n',
|
||||
'<blockquote>\n<p>a</p>\n</blockquote>',
|
||||
'should support a block quote before a container'
|
||||
)
|
||||
|
||||
|
@ -1074,7 +1074,7 @@ test('micromark-extension-directive (syntax)', (t) => {
|
|||
|
||||
t.equal(
|
||||
micromark('* a\n:::a\nb', options()),
|
||||
'<ul>\n<li>a</li>\n</ul>\n',
|
||||
'<ul>\n<li>a</li>\n</ul>',
|
||||
'should support a list before a container'
|
||||
)
|
||||
|
||||
|
@ -1371,6 +1371,12 @@ test('content', (t) => {
|
|||
'should support lists w/ attribute braces in container directives'
|
||||
)
|
||||
|
||||
t.equal(
|
||||
micromark(':::i\n- +\na', options()),
|
||||
'',
|
||||
'should support lazy containers in an unclosed container directive'
|
||||
)
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue