fix(markdown): stably print lists in front of whitespace-only trailing newline (#5024)
parent
55e620bdc7
commit
669282e32a
|
@ -379,7 +379,8 @@ const baseParser = {
|
|||
astFormat: "mdast",
|
||||
hasPragma: pragma.hasPragma,
|
||||
locStart: node => node.position.start.offset,
|
||||
locEnd: node => node.position.end.offset
|
||||
locEnd: node => node.position.end.offset,
|
||||
preprocess: text => text.replace(/\n\s+$/, "\n") // workaround for https://github.com/remarkjs/remark/issues/350
|
||||
};
|
||||
|
||||
const markdownParser = Object.assign({}, baseParser, {
|
||||
|
|
|
@ -98,6 +98,82 @@ markdown\`
|
|||
|
||||
`;
|
||||
|
||||
exports[`issue-5021.js - babylon-verify 1`] = `
|
||||
if (true) {
|
||||
md\`
|
||||
text1
|
||||
- 123
|
||||
- 456
|
||||
|
||||
text2
|
||||
- 123
|
||||
- 456
|
||||
|
||||
text3
|
||||
- 123
|
||||
- 456
|
||||
\`;
|
||||
}
|
||||
|
||||
if (true) {
|
||||
md\`
|
||||
text1
|
||||
|
||||
- 123
|
||||
- 456
|
||||
|
||||
text2
|
||||
|
||||
- 123
|
||||
- 456
|
||||
|
||||
text3
|
||||
|
||||
- 123
|
||||
- 456
|
||||
\`;
|
||||
}
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
if (true) {
|
||||
md\`
|
||||
text1
|
||||
|
||||
- 123
|
||||
- 456
|
||||
|
||||
text2
|
||||
|
||||
- 123
|
||||
- 456
|
||||
|
||||
text3
|
||||
|
||||
- 123
|
||||
- 456
|
||||
\`;
|
||||
}
|
||||
|
||||
if (true) {
|
||||
md\`
|
||||
text1
|
||||
|
||||
- 123
|
||||
- 456
|
||||
|
||||
text2
|
||||
|
||||
- 123
|
||||
- 456
|
||||
|
||||
text3
|
||||
|
||||
- 123
|
||||
- 456
|
||||
\`;
|
||||
}
|
||||
|
||||
`;
|
||||
|
||||
exports[`markdown.js - babylon-verify 1`] = `
|
||||
export default function ReadMe() {
|
||||
return md\`
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
if (true) {
|
||||
md`
|
||||
text1
|
||||
- 123
|
||||
- 456
|
||||
|
||||
text2
|
||||
- 123
|
||||
- 456
|
||||
|
||||
text3
|
||||
- 123
|
||||
- 456
|
||||
`;
|
||||
}
|
||||
|
||||
if (true) {
|
||||
md`
|
||||
text1
|
||||
|
||||
- 123
|
||||
- 456
|
||||
|
||||
text2
|
||||
|
||||
- 123
|
||||
- 456
|
||||
|
||||
text3
|
||||
|
||||
- 123
|
||||
- 456
|
||||
`;
|
||||
}
|
Loading…
Reference in New Issue