File tree 3 files changed +29
-1
lines changed
packages/prettier-plugin-liquid/src
3 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -519,8 +519,10 @@ export function printLiquidDocParam(
519
519
parts . push ( ' ' , `{${ node . paramType . value } }` ) ;
520
520
}
521
521
522
- if ( node . paramName . value ) {
522
+ if ( node . required ) {
523
523
parts . push ( ' ' , node . paramName . value ) ;
524
+ } else {
525
+ parts . push ( ' ' , `[${ node . paramName . value } ]` ) ;
524
526
}
525
527
526
528
if ( node . paramDescription ?. value ) {
Original file line number Diff line number Diff line change @@ -27,3 +27,16 @@ It should normalize the param description
27
27
{% doc %}
28
28
@param paramName - param with description
29
29
{% enddoc %}
30
+
31
+ It should strip whitespace between optional param delimiters
32
+ {% doc %}
33
+ @param [paramName] - param with description
34
+ {% enddoc %}
35
+
36
+ It should not break params with malformed optional delimiters
37
+ {% doc %}
38
+ @param [missingTail - param with description
39
+ @param missingHead] - param with description
40
+ @param [too many words no desc]
41
+ @param [too many words] - param with description
42
+ {% enddoc %}
Original file line number Diff line number Diff line change @@ -27,3 +27,16 @@ It should normalize the param description
27
27
{% doc %}
28
28
@param paramName - param with description
29
29
{% enddoc %}
30
+
31
+ It should strip whitespace between optional param delimiters
32
+ {% doc %}
33
+ @param [ paramName ] - param with description
34
+ {% enddoc %}
35
+
36
+ It should handle params with malformed optional delimiters
37
+ {% doc %}
38
+ @param [missingTail - param with description
39
+ @param missingHead] - param with description
40
+ @param [too many words no desc]
41
+ @param [too many words] - param with description
42
+ {% enddoc %}
You can’t perform that action at this time.
0 commit comments