diff --git a/src/language-html/printer-html.js b/src/language-html/printer-html.js index fb5f58c328ff..6dcf29609c5b 100644 --- a/src/language-html/printer-html.js +++ b/src/language-html/printer-html.js @@ -200,7 +200,11 @@ function genericPrint(path, options, print) { : node.firstChild.type === "text" && node.firstChild.isWhitespaceSensitive && node.firstChild.isIndentationSensitive - ? node.firstChild.value.indexOf("\n") === -1 + ? (node.children.length === 1 && + node.firstChild.type === "text" && + node.firstChild.value.indexOf("\n") === -1) || + node.firstChild.sourceSpan.start.line === + node.lastChild.sourceSpan.end.line ? "" : literalline : node.firstChild.hasLeadingSpaces && diff --git a/src/language-html/utils.js b/src/language-html/utils.js index 9dd78fecf90c..7ad32b06cf1a 100644 --- a/src/language-html/utils.js +++ b/src/language-html/utils.js @@ -43,7 +43,9 @@ function hasPrettierIgnore(path) { // TODO: handle non-text children in
   if (
     isPreLikeNode(node) &&
-    node.children.some(child => child.type !== "text")
+    node.children.some(
+      child => child.type !== "text" && child.type !== "interpolation"
+    )
   ) {
     return true;
   }
diff --git a/tests/html_vue/__snapshots__/jsfmt.spec.js.snap b/tests/html_vue/__snapshots__/jsfmt.spec.js.snap
index cfb1254a31cb..cfd9da489fde 100644
--- a/tests/html_vue/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/html_vue/__snapshots__/jsfmt.spec.js.snap
@@ -833,6 +833,19 @@ exports[`pre-child.vue - vue-verify 1`] = `
     {{ code }}
   
+ + + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~