fix(markdown): do not break before special prefix (#3347)

master
Ika 2017-11-30 05:43:22 +08:00 committed by Lucas Azzola
parent 562b4e19d1
commit 7670024292
3 changed files with 12 additions and 1 deletions

View File

@ -100,7 +100,7 @@ function genericPrint(path, options, print) {
const nextNode = parentNode.children[index + 1];
// leading char that may cause different syntax
if (nextNode && /^>|^([-+*]|#{1,6})$/.test(nextNode.value)) {
if (nextNode && /^>|^([-+*]|#{1,6}|[0-9]+[.)])$/.test(nextNode.value)) {
return node.value === "" ? "" : " ";
}

View File

@ -116,6 +116,8 @@ abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc
- disallow identical titles.
* [valid-expect](/packages/eslint-plugin-jest/docs/rules/valid-expect.md) -
ensure expect is called correctly.
She grew up in an isolated village in the 19th century and met her father aged 29. Oh no, why are we in a numbered list now?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc
abc - abc abc abc
@ -142,6 +144,9 @@ abc - abc abc abc
* [valid-expect](/packages/eslint-plugin-jest/docs/rules/valid-expect.md) -
ensure expect is called correctly.
She grew up in an isolated village in the 19th century and met her father
aged 29. Oh no, why are we in a numbered list now?
`;
exports[`special-prefix.md 2`] = `
@ -164,6 +169,8 @@ abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc
- disallow identical titles.
* [valid-expect](/packages/eslint-plugin-jest/docs/rules/valid-expect.md) -
ensure expect is called correctly.
She grew up in an isolated village in the 19th century and met her father aged 29. Oh no, why are we in a numbered list now?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc - abc abc abc
@ -184,6 +191,8 @@ abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc
* disallow identical titles.
* [valid-expect](/packages/eslint-plugin-jest/docs/rules/valid-expect.md) - ensure expect is called correctly.
She grew up in an isolated village in the 19th century and met her father aged 29. Oh no, why are we in a numbered list now?
`;
exports[`whitespace.md 1`] = `

View File

@ -17,3 +17,5 @@ abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc
- disallow identical titles.
* [valid-expect](/packages/eslint-plugin-jest/docs/rules/valid-expect.md) -
ensure expect is called correctly.
She grew up in an isolated village in the 19th century and met her father aged 29. Oh no, why are we in a numbered list now?