From 49f578fb91a65104fd8342626dfb56077b8e1104 Mon Sep 17 00:00:00 2001 From: Ika Date: Sat, 11 Nov 2017 12:50:40 +0800 Subject: [PATCH] fix(markdown): do not break `inlineCode` (#3230) --- src/printer-markdown.js | 3 ++- tests/markdown/__snapshots__/jsfmt.spec.js.snap | 8 ++++---- .../markdown_inlineCode/__snapshots__/jsfmt.spec.js.snap | 7 +++++++ tests/markdown_inlineCode/long.md | 1 + 4 files changed, 14 insertions(+), 5 deletions(-) create mode 100644 tests/markdown_inlineCode/long.md diff --git a/src/printer-markdown.js b/src/printer-markdown.js index 214f8c60..c16e3fd1 100644 --- a/src/printer-markdown.js +++ b/src/printer-markdown.js @@ -22,7 +22,8 @@ const SINGLE_LINE_NODE_TYPES = [ "heading", "tableCell", "footnoteDefinition", - "link" + "link", + "inlineCode" ]; const SIBLING_NODE_TYPES = ["listItem", "definition", "footnoteDefinition"]; diff --git a/tests/markdown/__snapshots__/jsfmt.spec.js.snap b/tests/markdown/__snapshots__/jsfmt.spec.js.snap index 93d9cbdf..d11240c2 100644 --- a/tests/markdown/__snapshots__/jsfmt.spec.js.snap +++ b/tests/markdown/__snapshots__/jsfmt.spec.js.snap @@ -1312,8 +1312,8 @@ from this behavior use \`--with-node-modules\` flag. #### \`--write\` -This rewrites all processed files in place. This is comparable to the \`eslint ---fix\` workflow. +This rewrites all processed files in place. This is comparable to the +\`eslint --fix\` workflow. ### ESLint @@ -1856,8 +1856,8 @@ for more details see ### Visual Studio Code -Can be installed using the extension sidebar. Search for \`Prettier - JavaScript -formatter\`. +Can be installed using the extension sidebar. Search for +\`Prettier - JavaScript formatter\`. Can also be installed using \`ext install prettier-vscode\`. diff --git a/tests/markdown_inlineCode/__snapshots__/jsfmt.spec.js.snap b/tests/markdown_inlineCode/__snapshots__/jsfmt.spec.js.snap index b26b15fc..0c667dca 100644 --- a/tests/markdown_inlineCode/__snapshots__/jsfmt.spec.js.snap +++ b/tests/markdown_inlineCode/__snapshots__/jsfmt.spec.js.snap @@ -30,6 +30,13 @@ exports[`escape.md 1`] = ` `; +exports[`long.md 1`] = ` +\`this is a long long long long long long long long long long long long long long long inline code\` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +\`this is a long long long long long long long long long long long long long long long inline code\` + +`; + exports[`simple.md 1`] = ` \`123\` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/tests/markdown_inlineCode/long.md b/tests/markdown_inlineCode/long.md new file mode 100644 index 00000000..7892800d --- /dev/null +++ b/tests/markdown_inlineCode/long.md @@ -0,0 +1 @@ +`this is a long long long long long long long long long long long long long long long inline code`