Skip to content

Commit

Permalink
Merge pull request #668 from Shopify/jm/normalize_description
Browse files Browse the repository at this point in the history
Normalize param description in LiquidDoc
  • Loading branch information
jamesmengo authored Dec 19, 2024
2 parents f4da6ca + ba1cf41 commit 38b6f21
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/prettier-plugin-liquid/src/printer/print/liquid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -524,10 +524,11 @@ export function printLiquidDocParam(
}

if (node.paramDescription.value) {
const normalizedDescription = node.paramDescription.value.replace(/\s+/g, ' ').trim();
if (node.paramDescription.dashSeparated) {
parts.push(' - ', node.paramDescription.value);
parts.push(' - ', normalizedDescription);
} else {
parts.push(' ', node.paramDescription.value);
parts.push(' ', normalizedDescription);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,8 @@ It should format the param description with a dash separator
{% doc %}
@param paramName - param with description
{% enddoc %}

It should normalize the param description
{% doc %}
@param paramName param with description
{% enddoc %}
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,9 @@ It should format the param description with a dash separator
{% doc %}
@param paramName - param with description
{% enddoc %}

It should normalize the param description
{% doc %}
@param paramName param with description
{% enddoc %}

0 comments on commit 38b6f21

Please sign in to comment.