Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Nov 29, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/printer-markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 === "" ? "" : " ";
}

Expand Down
9 changes: 9 additions & 0 deletions tests/markdown_paragraph/__snapshots__/jsfmt.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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`] = `
Expand All @@ -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

Expand All @@ -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`] = `
Expand Down
2 changes: 2 additions & 0 deletions tests/markdown_paragraph/special-prefix.md
Original file line number Diff line number Diff line change
Expand Up @@ -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?