mdast-util-gfm-task-list-item
Advanced tools
Comparing version 0.1.4 to 0.1.5
@@ -14,7 +14,11 @@ exports.exit = { | ||
function exitParagraphWithTaskListItem(token) { | ||
var parent = this.stack[this.stack.length - 2] | ||
var node = this.stack[this.stack.length - 1] | ||
var parent = this.stack[this.stack.length - 2] | ||
var siblings = parent.children | ||
var head = node.children[0] | ||
var index = -1 | ||
var firstParaghraph | ||
if ( | ||
parent && | ||
parent.type === 'listItem' && | ||
@@ -25,11 +29,21 @@ typeof parent.checked === 'boolean' && | ||
) { | ||
// Must start with a space or a tab. | ||
head.value = head.value.slice(1) | ||
if (head.value.length === 0) { | ||
node.children.shift() | ||
} else { | ||
head.position.start.column++ | ||
head.position.start.offset++ | ||
node.position.start = Object.assign({}, head.position.start) | ||
while (++index < siblings.length) { | ||
if (siblings[index].type === 'paragraph') { | ||
firstParaghraph = siblings[index] | ||
break | ||
} | ||
} | ||
if (firstParaghraph === node) { | ||
// Must start with a space or a tab. | ||
head.value = head.value.slice(1) | ||
if (head.value.length === 0) { | ||
node.children.shift() | ||
} else { | ||
head.position.start.column++ | ||
head.position.start.offset++ | ||
node.position.start = Object.assign({}, head.position.start) | ||
} | ||
} | ||
} | ||
@@ -36,0 +50,0 @@ |
{ | ||
"name": "mdast-util-gfm-task-list-item", | ||
"version": "0.1.4", | ||
"version": "0.1.5", | ||
"description": "mdast extension to parse and serialize GFM task list items", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -176,5 +176,5 @@ # mdast-util-gfm-task-list-item | ||
[build-badge]: https://img.shields.io/travis/syntax-tree/mdast-util-gfm-task-list-item.svg | ||
[build-badge]: https://github.com/syntax-tree/mdast-util-gfm-task-list-item/workflows/main/badge.svg | ||
[build]: https://travis-ci.org/syntax-tree/mdast-util-gfm-task-list-item | ||
[build]: https://github.com/syntax-tree/mdast-util-gfm-task-list-item/actions | ||
@@ -181,0 +181,0 @@ [coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/mdast-util-gfm-task-list-item.svg |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10859
62