Skip to content

feat(filters): add squish filter - #943

Open
MildlyMeticulous wants to merge 1 commit into
harttle:masterfrom
MildlyMeticulous:feat/squish-filter
Open

feat(filters): add squish filter#943
MildlyMeticulous wants to merge 1 commit into
harttle:masterfrom
MildlyMeticulous:feat/squish-filter

Conversation

@MildlyMeticulous

Copy link
Copy Markdown

squish is a standard Shopify/liquid string filter and LiquidJS doesn't have it, so {{ "Hello World!" | squish }} currently renders unchanged rather than Hello World!.

engine.parseAndRenderSync('{{ "  Hello   World!  " | squish }}')
// before: "  Hello   World!  "
// after:  "Hello World!"

Strips leading and trailing whitespace and collapses each internal run to a single space, matching Shopify/liquid 5.12.0. Added alongside strip_newlines in src/filters/string.ts, with docs and a sidebar entry.

Verified against all 17 squish cases in golden-liquid, which tests against Shopify/liquid as the reference implementation. All pass. 1588 tests pass here; the new tests fail on revert.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant