fix(markdown): preserve non-breakable whitespaces (#3327)
parent
1c9ee6c5a7
commit
9b4ecec183
|
@ -683,8 +683,7 @@ function splitText(text) {
|
|||
|
||||
text
|
||||
.replace(new RegExp(`(${cjkPattern})\n(${cjkPattern})`, "g"), "$1$2")
|
||||
// `\s` but exclude full-width whitspace (`\u3000`)
|
||||
.split(/([^\S\u3000]+)/)
|
||||
.split(/([ \t\n]+)/)
|
||||
.forEach((token, index, tokens) => {
|
||||
// whitespace
|
||||
if (index % 2 === 1) {
|
||||
|
|
|
@ -185,3 +185,42 @@ abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc
|
|||
* [valid-expect](/packages/eslint-plugin-jest/docs/rules/valid-expect.md) - ensure expect is called correctly.
|
||||
|
||||
`;
|
||||
|
||||
exports[`whitespace.md 1`] = `
|
||||
<!-- 0xA0 non-breaking whitespace -->
|
||||
|
||||
keep these words together keep these words together keep these words together keep these words together
|
||||
|
||||
<!-- 0x20 standard whitespace -->
|
||||
|
||||
keep these words together keep these words together keep these words together keep these words together
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
<!-- 0xA0 non-breaking whitespace -->
|
||||
|
||||
keep these words together keep these words together keep these words together keep these words together
|
||||
|
||||
<!-- 0x20 standard whitespace -->
|
||||
|
||||
keep these words together keep these words together keep these words together
|
||||
keep these words together
|
||||
|
||||
`;
|
||||
|
||||
exports[`whitespace.md 2`] = `
|
||||
<!-- 0xA0 non-breaking whitespace -->
|
||||
|
||||
keep these words together keep these words together keep these words together keep these words together
|
||||
|
||||
<!-- 0x20 standard whitespace -->
|
||||
|
||||
keep these words together keep these words together keep these words together keep these words together
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
<!-- 0xA0 non-breaking whitespace -->
|
||||
|
||||
keep these words together keep these words together keep these words together keep these words together
|
||||
|
||||
<!-- 0x20 standard whitespace -->
|
||||
|
||||
keep these words together keep these words together keep these words together keep these words together
|
||||
|
||||
`;
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
<!-- 0xA0 non-breaking whitespace -->
|
||||
|
||||
keep these words together keep these words together keep these words together keep these words together
|
||||
|
||||
<!-- 0x20 standard whitespace -->
|
||||
|
||||
keep these words together keep these words together keep these words together keep these words together
|
|
@ -3635,7 +3635,7 @@ a*"foo"*
|
|||
exports[`example-328.md 1`] = `
|
||||
* a *
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
_ a _
|
||||
_ a _
|
||||
|
||||
`;
|
||||
|
||||
|
|
Loading…
Reference in New Issue