fix(markdown): do not keep increasing backslashes for dollar sign (#5358)

master
Ika 2018-11-07 10:06:57 +08:00 committed by GitHub
parent e0362516af
commit 8cedb9d25e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 31 additions and 4 deletions

View File

@ -46,7 +46,8 @@ function restoreUnescapedCharacter(ast, options) {
: Object.assign({}, node, {
value:
node.value !== "*" &&
node.value !== "_" && // handle these two cases in printer
node.value !== "_" &&
node.value !== "$" && // handle these cases in printer
isSingleCharRegex.test(node.value) &&
node.position.end.offset - node.position.start.offset !==
node.value.length

View File

@ -1,5 +1,24 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`dollar-sign.md - markdown-verify 1`] = `
$
\\$
\\\\$
\\\\\\$
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
\\$
\\$
\\\\\\$
\\\\\\$
`;
exports[`empty-block.md - markdown-verify 1`] = `
$$
$$
@ -107,7 +126,7 @@ $$
---
\\\\$\\alpha\\$
\\$\\alpha\\$
---

View File

@ -0,0 +1,7 @@
$
\$
\\$
\\\$

View File

@ -3306,7 +3306,7 @@ exports[`example-284.md - markdown-verify 1`] = `
exports[`example-285.md - markdown-verify 1`] = `
\\!\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\-\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\\\\\]\\^\\_\\\`\\{\\|\\}\\~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
\\!\\"\\#\\\\$\\%\\&\\'\\(\\)\\*\\+\\,\\-\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\\\\\]\\^\\_\\\`\\{\\|\\}\\~
\\!\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\-\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\\\\\]\\^\\_\\\`\\{\\|\\}\\~
`;

View File

@ -94,7 +94,7 @@ markdown\`
- \\\\\\\`
- \\\\ a
- \\\\\\\\
- \\\\$
- \\$
- \\u1234
\`;