File tree Expand file tree Collapse file tree 1 file changed +15
-9
lines changed
packages/prettier-plugin-liquid/src/printer/print Expand file tree Collapse file tree 1 file changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -564,12 +564,12 @@ export function printLiquidDocExample(
564
564
const parts : Doc [ ] = [ '@example' ] ;
565
565
566
566
const content = node . content . value ;
567
- if ( content ) {
568
- if ( content . includes ( '\n' ) ) {
569
- parts . push ( hardline ) ;
570
- }
571
- parts . push ( content . trim ( ) ) ;
567
+ if ( content . trimEnd ( ) . includes ( '\n' ) ) {
568
+ parts . push ( hardline ) ;
569
+ } else {
570
+ parts . push ( ' ' ) ;
572
571
}
572
+ parts . push ( content . trim ( ) ) ;
573
573
574
574
return parts ;
575
575
}
@@ -582,14 +582,20 @@ export function printLiquidDocDescription(
582
582
) : Doc {
583
583
const node = path . getValue ( ) ;
584
584
const parts : Doc [ ] = [ ] ;
585
+ const content = node . content . value ;
585
586
586
- if ( ! node . isImplicit ) {
587
- parts . push ( '@description ' ) ;
587
+ if ( node . isImplicit ) {
588
+ parts . push ( content . trim ( ) ) ;
589
+ return parts ;
588
590
}
589
591
590
- if ( node . content ?. value ) {
591
- parts . push ( node . content . value ) ;
592
+ parts . push ( '@description ' ) ;
593
+ if ( content . trimEnd ( ) . includes ( '\n' ) ) {
594
+ parts . push ( hardline ) ;
595
+ } else {
596
+ parts . push ( ' ' ) ;
592
597
}
598
+ parts . push ( content . trim ( ) ) ;
593
599
594
600
return parts ;
595
601
}
You can’t perform that action at this time.
0 commit comments