fix(markdown): force print spaces (#3225)
parent
49f578fb91
commit
92459047ed
|
@ -41,7 +41,7 @@ function makeAlign(ind, n) {
|
|||
indent: ind.indent,
|
||||
align: {
|
||||
spaces: ind.align.spaces + (typeof n === "number" ? " ".repeat(n) : n),
|
||||
tabs: ind.align.tabs + (n ? "\t" : "")
|
||||
tabs: ind.align.tabs + (typeof n === "number" ? (n ? "\t" : "") : n)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -186,9 +186,10 @@ function genericPrint(path, options, print) {
|
|||
)
|
||||
) {
|
||||
// indented code block
|
||||
const alignment = " ".repeat(4);
|
||||
return align(
|
||||
4,
|
||||
concat([" ".repeat(4), join(hardline, node.value.split("\n"))])
|
||||
alignment,
|
||||
concat([alignment, join(hardline, node.value.split("\n"))])
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -239,7 +240,10 @@ function genericPrint(path, options, print) {
|
|||
: isGitDiffFriendlyOrderedList ? 1 : node.start + index) +
|
||||
(nthSiblingIndex % 2 === 0 ? ". " : ") ")
|
||||
: nthSiblingIndex % 2 === 0 ? "* " : "- ";
|
||||
return concat([prefix, align(prefix.length, childPath.call(print))]);
|
||||
return concat([
|
||||
prefix,
|
||||
align(" ".repeat(prefix.length), childPath.call(print))
|
||||
]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -248,7 +252,7 @@ function genericPrint(path, options, print) {
|
|||
node.checked === null ? "" : node.checked ? "[x] " : "[ ] ";
|
||||
return concat([
|
||||
prefix,
|
||||
align(prefix.length, printChildren(path, options, print))
|
||||
align(" ".repeat(prefix.length), printChildren(path, options, print))
|
||||
]);
|
||||
}
|
||||
case "thematicBreak": {
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`example.md 1`] = `
|
||||
- Top level list item 1
|
||||
- Top level list item 2
|
||||
- Nested List item 1
|
||||
- Nested List item 2
|
||||
- Sub-Nested List item 1
|
||||
- Sub-Nested List item 2
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* Top level list item 1
|
||||
* Top level list item 2
|
||||
* Nested List item 1
|
||||
* Nested List item 2
|
||||
* Sub-Nested List item 1
|
||||
* Sub-Nested List item 2
|
||||
|
||||
`;
|
|
@ -0,0 +1,6 @@
|
|||
- Top level list item 1
|
||||
- Top level list item 2
|
||||
- Nested List item 1
|
||||
- Nested List item 2
|
||||
- Sub-Nested List item 1
|
||||
- Sub-Nested List item 2
|
|
@ -0,0 +1 @@
|
|||
run_spec(__dirname, { parser: "markdown", useTabs: true });
|
Loading…
Reference in New Issue