Skip to content

Commit 114b680

Browse files
authored
fix: stop swallowing characters in indented heredoc (#1576)
Fixes #1543
1 parent 33ec9da commit 114b680

File tree

5 files changed

+1070
-9
lines changed

5 files changed

+1070
-9
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@
4747
"test": "jest",
4848
"prepublishOnly": "yarpm run build-standalone && cross-env RUN_STANDALONE_TESTS=true yarpm test",
4949
"prettier": "prettier --plugin=. --parser=php",
50-
"build-standalone": "rollup -c build/rollup.config.js"
50+
"build-standalone": "rollup -c build/rollup.config.js",
51+
"debug": "node --inspect-brk node_modules/.bin/jest --runInBand"
5152
},
5253
"jest": {
5354
"projects": [

src/printer.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2795,7 +2795,11 @@ function printNode(path, options, print) {
27952795
linebreak,
27962796
node.raw
27972797
.split(/\r?\n/g)
2798-
.map((s) => s.substring(closingTagIndentation))
2798+
.map((s, i) =>
2799+
i > 0 || node.loc.start.column === 0
2800+
? s.substring(closingTagIndentation)
2801+
: s
2802+
)
27992803
);
28002804
}
28012805

0 commit comments

Comments
 (0)