fix(markdown): only indent the first non-list node in checkbox list item (#3297)
* fix(markdown): do not indent checkbox * fix: keep alignment for first non-list node * fix: force whitespacesmaster
parent
cbed0f487f
commit
d5a3abd7a6
|
@ -249,7 +249,12 @@ function genericPrint(path, options, print) {
|
||||||
node.checked === null ? "" : node.checked ? "[x] " : "[ ] ";
|
node.checked === null ? "" : node.checked ? "[x] " : "[ ] ";
|
||||||
return concat([
|
return concat([
|
||||||
prefix,
|
prefix,
|
||||||
align(" ".repeat(prefix.length), printChildren(path, options, print))
|
printChildren(path, options, print, {
|
||||||
|
processor: (childPath, index) =>
|
||||||
|
index === 0 && childPath.getValue().type !== "list"
|
||||||
|
? align(" ".repeat(prefix.length), childPath.call(print))
|
||||||
|
: childPath.call(print)
|
||||||
|
})
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
case "thematicBreak": {
|
case "thematicBreak": {
|
||||||
|
|
|
@ -77,6 +77,39 @@ exports[`nested.md 1`] = `
|
||||||
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
exports[`nested-checkbox.md 1`] = `
|
||||||
|
* parent list item parent list item parent list item parent list item parent list item parent list item
|
||||||
|
|
||||||
|
* child list item child list item child list item child list item child list item child list item
|
||||||
|
|
||||||
|
paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph
|
||||||
|
|
||||||
|
* [x] parent task list item parent task list item parent task list item parent task list item
|
||||||
|
|
||||||
|
* [x] child task list item child task list item child task list item child task list item
|
||||||
|
|
||||||
|
paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
* parent list item parent list item parent list item parent list item parent
|
||||||
|
list item parent list item
|
||||||
|
|
||||||
|
* child list item child list item child list item child list item child list
|
||||||
|
item child list item
|
||||||
|
|
||||||
|
paragraph paragraph paragraph paragraph paragraph paragraph paragraph
|
||||||
|
paragraph paragraph
|
||||||
|
|
||||||
|
* [x] parent task list item parent task list item parent task list item parent
|
||||||
|
task list item
|
||||||
|
|
||||||
|
* [x] child task list item child task list item child task list item child
|
||||||
|
task list item
|
||||||
|
|
||||||
|
paragraph paragraph paragraph paragraph paragraph paragraph paragraph
|
||||||
|
paragraph paragraph
|
||||||
|
|
||||||
|
`;
|
||||||
|
|
||||||
exports[`ordered.md 1`] = `
|
exports[`ordered.md 1`] = `
|
||||||
1. 123
|
1. 123
|
||||||
1. 456
|
1. 456
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
* parent list item parent list item parent list item parent list item parent list item parent list item
|
||||||
|
|
||||||
|
* child list item child list item child list item child list item child list item child list item
|
||||||
|
|
||||||
|
paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph
|
||||||
|
|
||||||
|
* [x] parent task list item parent task list item parent task list item parent task list item
|
||||||
|
|
||||||
|
* [x] child task list item child task list item child task list item child task list item
|
||||||
|
|
||||||
|
paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph
|
Loading…
Reference in New Issue