File tree Expand file tree Collapse file tree 5 files changed +31
-0
lines changed
test/formatting/samples/component-ignore-whitespace Expand file tree Collapse file tree 5 files changed +31
-0
lines changed Original file line number Diff line number Diff line change 11# prettier-plugin-svelte changelog
22
3+ ## 2.6.1 (Unreleased)
4+
5+ * (fix) respect whitespace "ignore" setting for components ([ #281 ] ( https://github.com/sveltejs/prettier-plugin-svelte/issues/281 ) )
6+
37## 2.6.0
48
59* (feat) Support ` {@const} ` tag ([ #272 ] ( https://github.com/sveltejs/prettier-plugin-svelte/issues/272 ) )
Original file line number Diff line number Diff line change @@ -396,6 +396,10 @@ export function shouldHugStart(
396396 return true ;
397397 }
398398
399+ if ( options . htmlWhitespaceSensitivity === 'ignore' ) {
400+ return false ;
401+ }
402+
399403 const firstChild = children [ 0 ] ;
400404 return ! isTextNodeStartingWithWhitespace ( firstChild ) ;
401405}
@@ -426,6 +430,10 @@ export function shouldHugEnd(
426430 return true ;
427431 }
428432
433+ if ( options . htmlWhitespaceSensitivity === 'ignore' ) {
434+ return false ;
435+ }
436+
429437 const lastChild = children [ children . length - 1 ] ;
430438 return ! isTextNodeEndingWithWhitespace ( lastChild ) ;
431439}
Original file line number Diff line number Diff line change 1+ < p > < ExternalLink href ="https://www.buymeacoffee.com "> buy</ ExternalLink > !</ p >
2+
3+ < p > < ExternalLink href ="https://www.buymeacoffee.com "> buy me a</ ExternalLink > !</ p >
4+
5+ < p > < ExternalLink href ="https://www.buymeacoffee.com "> buy me a coffee</ ExternalLink > !</ p >
Original file line number Diff line number Diff line change 1+ {
2+ "htmlWhitespaceSensitivity" : " ignore"
3+ }
Original file line number Diff line number Diff line change 1+ < p > < ExternalLink href ="https://www.buymeacoffee.com "> buy</ ExternalLink > !</ p >
2+
3+ < p >
4+ < ExternalLink href ="https://www.buymeacoffee.com "> buy me a</ ExternalLink > !
5+ </ p >
6+
7+ < p >
8+ < ExternalLink href ="https://www.buymeacoffee.com ">
9+ buy me a coffee
10+ </ ExternalLink > !
11+ </ p >
You can’t perform that action at this time.
0 commit comments