planning
All checks were successful
Publish To Prod / deploy_and_publish (push) Successful in 35s

This commit is contained in:
2024-10-14 09:15:30 +02:00
parent bcba00a730
commit 6e64e138e2
21059 changed files with 2317811 additions and 1 deletions

View File

@@ -0,0 +1,80 @@
var markdownLineEndingOrSpace = require('micromark/dist/character/markdown-line-ending-or-space')
var spaceFactory = require('micromark/dist/tokenize/factory-space')
var prefixSize = require('micromark/dist/util/prefix-size')
var tasklistCheck = {tokenize: tokenizeTasklistCheck}
exports.text = {91: tasklistCheck}
function tokenizeTasklistCheck(effects, ok, nok) {
var self = this
return open
function open(code) {
if (
// Exit if not `[`.
code !== 91 ||
// Exit if theres stuff before.
self.previous !== null ||
// Exit if not in the first content that is the first child of a list
// item.
!self._gfmTasklistFirstContentOfListItem
) {
return nok(code)
}
effects.enter('taskListCheck')
effects.enter('taskListCheckMarker')
effects.consume(code)
effects.exit('taskListCheckMarker')
return inside
}
function inside(code) {
// Tab or space.
if (code === -2 || code === 32) {
effects.enter('taskListCheckValueUnchecked')
effects.consume(code)
effects.exit('taskListCheckValueUnchecked')
return close
}
// Upper- and lower `x`.
if (code === 88 || code === 120) {
effects.enter('taskListCheckValueChecked')
effects.consume(code)
effects.exit('taskListCheckValueChecked')
return close
}
return nok(code)
}
function close(code) {
// `]`
if (code === 93) {
effects.enter('taskListCheckMarker')
effects.consume(code)
effects.exit('taskListCheckMarker')
effects.exit('taskListCheck')
return effects.check({tokenize: spaceThenNonSpace}, ok, nok)
}
return nok(code)
}
}
function spaceThenNonSpace(effects, ok, nok) {
var self = this
return spaceFactory(effects, after, 'whitespace')
function after(code) {
return prefixSize(self.events, 'whitespace') &&
code !== null &&
!markdownLineEndingOrSpace(code)
? ok(code)
: nok(code)
}
}